Clipping the checkerboard pattern

This commit is contained in:
Jonathan Johnson 2024-01-11 07:17:38 -08:00
parent d701e179ae
commit 64ad120be6
No known key found for this signature in database
GPG key ID: A66D6A34D6620579

View file

@ -344,12 +344,11 @@ impl ColorComponent for Alpha {
);
let mut y = Px::ZERO;
let mut offset = false;
let mut gfx = context.gfx.clipped_to(rect);
while y < rect.size.height {
let mut x = if offset { checker_size } else { Px::ZERO };
while x < rect.size.width {
context
.gfx
.draw_shape(shape.translate_by(rect.origin + Point::new(x, y)));
gfx.draw_shape(shape.translate_by(Point::new(x, y)));
x += checker_size * 2;
}
y += checker_size;