gfx: Use a pattern instead of tiling images manually.

This commit is contained in:
Patrick Walton 2015-06-26 14:39:59 -07:00
parent a3821bf240
commit 3500af37d0
7 changed files with 77 additions and 40 deletions

View file

@ -1068,28 +1068,11 @@ impl DisplayItem {
}
DisplayItem::ImageClass(ref image_item) => {
// FIXME(pcwalton): This is a really inefficient way to draw a tiled image; use a
// brush instead.
debug!("Drawing image at {:?}.", image_item.base.bounds);
let mut y_offset = Au(0);
while y_offset < image_item.base.bounds.size.height {
let mut x_offset = Au(0);
while x_offset < image_item.base.bounds.size.width {
let mut bounds = image_item.base.bounds;
bounds.origin.x = bounds.origin.x + x_offset;
bounds.origin.y = bounds.origin.y + y_offset;
bounds.size = image_item.stretch_size;
paint_context.draw_image(&bounds,
image_item.image.clone(),
image_item.image_rendering.clone());
x_offset = x_offset + image_item.stretch_size.width;
}
y_offset = y_offset + image_item.stretch_size.height;
}
paint_context.draw_image(&image_item.base.bounds,
&image_item.stretch_size,
image_item.image.clone(),
image_item.image_rendering.clone());
}
DisplayItem::BorderClass(ref border) => {