From e47c8e7738db185e5a34194f437862457dec46dc Mon Sep 17 00:00:00 2001 From: WR Updater Bot Date: Wed, 19 Dec 2018 03:15:14 +0000 Subject: [PATCH] Bug 1515040 - Update webrender to commit 9b6c5347c03bd123e0704b7bbd823f3f9fdc9334 (WR PR #3430). r=kats https://github.com/servo/webrender/pull/3430 Differential Revision: https://phabricator.services.mozilla.com/D14935 --- gfx/webrender_bindings/revision.txt | 2 +- gfx/wr/webrender/src/picture.rs | 24 ++++++++++++++++++++++-- gfx/wr/webrender/src/prim_store/mod.rs | 4 ++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gfx/webrender_bindings/revision.txt b/gfx/webrender_bindings/revision.txt index cb90a90f2e0a8..3185bd6b3032f 100644 --- a/gfx/webrender_bindings/revision.txt +++ b/gfx/webrender_bindings/revision.txt @@ -1 +1 @@ -14df2e43424ebc38044158f716c769d26e35b161 +9b6c5347c03bd123e0704b7bbd823f3f9fdc9334 diff --git a/gfx/wr/webrender/src/picture.rs b/gfx/wr/webrender/src/picture.rs index 39d2c999d1f96..f19e2f61641d4 100644 --- a/gfx/wr/webrender/src/picture.rs +++ b/gfx/wr/webrender/src/picture.rs @@ -449,7 +449,14 @@ impl TileCache { .unmap(&world_tile_rect) .expect("bug: unable to get local tile size"); self.local_tile_size = local_tile_rect.size; - self.local_origin = pic_rect.origin; + + // Round the local reference point down to a whole number. This ensures + // that the bounding rect of the tile corresponds to a pixel boundary, and + // the content is offset by a fractional amount inside the surface itself. + // This means that when drawing the tile it's fine to use a simple 0-1 + // UV mapping, instead of trying to determine a fractional UV rect that + // is slightly inside the allocated tile surface. + self.local_origin = pic_rect.origin.floor(); // Walk the transforms and see if we need to rebuild the primitive // dependencies for each tile. @@ -894,10 +901,23 @@ impl TileCache { } } + // For the primitive origin, store the local origin relative to + // the local origin of the containing picture. This ensures that + // a tile with primitives in the same coordinate system as the + // container picture itself, but different offsets relative to + // the containing picture are correctly invalidated. It does this + // while still maintaining the property of keeping the same hash + // for different display lists where the local origin is different + // but the primitives themselves are at the same relative position. + let origin = PointKey { + x: prim_rect.origin.x - self.local_origin.x, + y: prim_rect.origin.y - self.local_origin.y, + }; + // Update the tile descriptor, used for tile comparison during scene swaps. tile.descriptor.prims.push(PrimitiveDescriptor { prim_uid: prim_instance.uid(), - origin: prim_instance.prim_origin.into(), + origin, first_clip: tile.descriptor.clip_uids.len() as u16, clip_count: clip_chain_uids.len() as u16, }); diff --git a/gfx/wr/webrender/src/prim_store/mod.rs b/gfx/wr/webrender/src/prim_store/mod.rs index 1361009119d7d..5e87ea4a2f2fb 100644 --- a/gfx/wr/webrender/src/prim_store/mod.rs +++ b/gfx/wr/webrender/src/prim_store/mod.rs @@ -657,8 +657,8 @@ impl From for VectorKey { #[cfg_attr(feature = "replay", derive(Deserialize))] #[derive(Debug, Clone, PartialEq)] pub struct PointKey { - x: f32, - y: f32, + pub x: f32, + pub y: f32, } impl Eq for PointKey {}