feat: build a resizable native developer workspace with console and network inspection
Verify Tessera GUI / verify (push) Failing after 7m12s
Verify Tessera GUI / verify (push) Failing after 7m12s
This commit is contained in:
@@ -12,10 +12,34 @@ impl SoftwareRenderer {
|
||||
pixels: target,
|
||||
width,
|
||||
height,
|
||||
clip: Rect::new(0.0, 0.0, width as f32, height as f32),
|
||||
};
|
||||
let mut clips = Vec::new();
|
||||
|
||||
for command in list.commands() {
|
||||
match command {
|
||||
DrawCommand::PushClip(rect) => {
|
||||
clips.push(canvas.clip);
|
||||
let x = canvas.clip.x.max(rect.x);
|
||||
let y = canvas.clip.y.max(rect.y);
|
||||
canvas.clip = Rect::new(
|
||||
x,
|
||||
y,
|
||||
(canvas.clip.x + canvas.clip.width)
|
||||
.min(rect.x + rect.width)
|
||||
.max(x)
|
||||
- x,
|
||||
(canvas.clip.y + canvas.clip.height)
|
||||
.min(rect.y + rect.height)
|
||||
.max(y)
|
||||
- y,
|
||||
);
|
||||
}
|
||||
DrawCommand::PopClip => {
|
||||
if let Some(clip) = clips.pop() {
|
||||
canvas.clip = clip;
|
||||
}
|
||||
}
|
||||
DrawCommand::Clear(color) => canvas.clear(*color),
|
||||
DrawCommand::FillRoundedRect {
|
||||
rect,
|
||||
@@ -43,6 +67,7 @@ struct Canvas<'a> {
|
||||
pixels: &'a mut [u32],
|
||||
width: u32,
|
||||
height: u32,
|
||||
clip: Rect,
|
||||
}
|
||||
|
||||
impl Canvas<'_> {
|
||||
@@ -97,15 +122,29 @@ impl Canvas<'_> {
|
||||
|
||||
fn clamped_bounds(&self, rect: Rect) -> (i32, i32, i32, i32) {
|
||||
(
|
||||
rect.x.max(0.0).floor() as i32,
|
||||
rect.y.max(0.0).floor() as i32,
|
||||
(rect.x + rect.width).min(self.width as f32).ceil() as i32,
|
||||
(rect.y + rect.height).min(self.height as f32).ceil() as i32,
|
||||
rect.x.max(self.clip.x).max(0.0).floor() as i32,
|
||||
rect.y.max(self.clip.y).max(0.0).floor() as i32,
|
||||
(rect.x + rect.width)
|
||||
.min(self.clip.x + self.clip.width)
|
||||
.min(self.width as f32)
|
||||
.ceil() as i32,
|
||||
(rect.y + rect.height)
|
||||
.min(self.clip.y + self.clip.height)
|
||||
.min(self.height as f32)
|
||||
.ceil() as i32,
|
||||
)
|
||||
}
|
||||
|
||||
fn blend_pixel(&mut self, x: i32, y: i32, source: Color) {
|
||||
if x < 0 || y < 0 || x >= self.width as i32 || y >= self.height as i32 || source.alpha == 0
|
||||
if x < 0
|
||||
|| y < 0
|
||||
|| x >= self.width as i32
|
||||
|| y >= self.height as i32
|
||||
|| source.alpha == 0
|
||||
|| (x as f32) < self.clip.x
|
||||
|| (y as f32) < self.clip.y
|
||||
|| (x as f32) >= self.clip.x + self.clip.width
|
||||
|| (y as f32) >= self.clip.y + self.clip.height
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user