Bug 1515932 - WR fix establish_raster_root boolean on a picture r=gw
authorDzmitry Malyshau <dmalyshau@mozilla.com>
Fri, 01 Feb 2019 02:23:15 +0000
changeset 456383 c01ab8f120245d7f3a8f690bc6b2bd4d99c49352
parent 456382 af0f2236d4523927502d3f65e4cf56f61c9e84a4
child 456384 58fe5a3d3c403199b9ff87d2f5051fd6e0564a45
push id19
push usermdeboer@mozilla.com
push dateFri, 01 Feb 2019 10:05:45 +0000
reviewersgw
bugs1515932
milestone67.0a1
Bug 1515932 - WR fix establish_raster_root boolean on a picture r=gw This is a follow-up to https://phabricator.services.mozilla.com/D18258 which updates establish_raster_root boolean. It affects the perspective interpolation of brushes. Differential Revision: https://phabricator.services.mozilla.com/D18304
gfx/wr/webrender/src/picture.rs
--- a/gfx/wr/webrender/src/picture.rs
+++ b/gfx/wr/webrender/src/picture.rs
@@ -1688,20 +1688,17 @@ impl<'a> PictureUpdateState<'a> {
         let picture = &picture_primitives[pic_index.0];
         if !picture.is_visible() {
             return
         }
 
         let new_fallback = match picture.raster_config {
             Some(ref config) => {
                 let surface = &mut self.surfaces[config.surface_index.0];
-                if surface.surface_spatial_node_index == surface.raster_spatial_node_index && (
-                    surface.rect.size.width > MAX_SURFACE_SIZE ||
-                    surface.rect.size.height > MAX_SURFACE_SIZE
-                ) {
+                if !config.establishes_raster_root {
                     surface.raster_spatial_node_index = fallback_raster_spatial_node;
                 }
                 surface.raster_spatial_node_index
             }
             None => fallback_raster_spatial_node,
         };
 
         for child_pic_index in &picture.prim_list.pictures {
@@ -2641,17 +2638,17 @@ impl PicturePrimitive {
         }
 
         // Restore the pictures list used during recursion.
         self.prim_list.pictures = child_pictures;
 
         // If this picture establishes a surface, then map the surface bounding
         // rect into the parent surface coordinate space, and propagate that up
         // to the parent.
-        if let Some(ref raster_config) = self.raster_config {
+        if let Some(ref mut raster_config) = self.raster_config {
             let mut surface_rect = {
                 let surface = state.current_surface_mut();
                 // Inflate the local bounding rect if required by the filter effect.
                 // This inflaction factor is to be applied to the surface itsefl.
                 let inflation_size = match raster_config.composite_mode {
                     PictureCompositeMode::Filter(FilterOp::Blur(_)) => surface.inflation_factor,
                     PictureCompositeMode::Filter(FilterOp::DropShadow(_, blur_radius, _)) =>
                         (blur_radius * BLUR_SAMPLE_SCALE).ceil(),
@@ -2676,20 +2673,23 @@ impl PicturePrimitive {
                 gpu_cache.invalidate(&self.gpu_location);
                 if let PictureCompositeMode::Filter(FilterOp::DropShadow(..)) = raster_config.composite_mode {
                     gpu_cache.invalidate(&self.extra_gpu_data_handle);
                 }
                 self.local_rect = surface_rect;
             }
 
             // Check if any of the surfaces can't be rasterized in local space but want to.
-            if raster_config.establishes_raster_root && state.are_raster_roots_assigned {
-                state.are_raster_roots_assigned =
-                    surface_rect.size.width <= MAX_SURFACE_SIZE &&
-                    surface_rect.size.height <= MAX_SURFACE_SIZE;
+            if raster_config.establishes_raster_root {
+                if surface_rect.size.width > MAX_SURFACE_SIZE ||
+                    surface_rect.size.height > MAX_SURFACE_SIZE
+                {
+                    raster_config.establishes_raster_root = false;
+                    state.are_raster_roots_assigned = false;
+                }
             }
 
             // Drop shadows draw both a content and shadow rect, so need to expand the local
             // rect of any surfaces to be composited in parent surfaces correctly.
             if let PictureCompositeMode::Filter(FilterOp::DropShadow(offset, ..)) = raster_config.composite_mode {
                 let content_rect = surface_rect;
                 let shadow_rect = surface_rect.translate(&offset);
                 surface_rect = content_rect.union(&shadow_rect);