diff --git a/engine/src/flutter/flow/layers/container_layer.cc b/engine/src/flutter/flow/layers/container_layer.cc index ee031531fb..7e09f41737 100644 --- a/engine/src/flutter/flow/layers/container_layer.cc +++ b/engine/src/flutter/flow/layers/container_layer.cc @@ -43,6 +43,7 @@ void ContainerLayer::PrerollChildren(PrerollContext* context, // always be false. FML_DCHECK(!context->has_platform_view); bool child_has_platform_view = false; + bool child_has_texture_layer = false; for (auto& layer : layers_) { // Reset context->has_platform_view to false so that layers aren't treated // as if they have a platform view based on one being previously found in a @@ -58,9 +59,12 @@ void ContainerLayer::PrerollChildren(PrerollContext* context, child_has_platform_view = child_has_platform_view || context->has_platform_view; + child_has_texture_layer = + child_has_texture_layer || context->has_texture_layer; } context->has_platform_view = child_has_platform_view; + context->has_texture_layer = child_has_texture_layer; #if defined(LEGACY_FUCHSIA_EMBEDDER) if (child_layer_exists_below_) { @@ -90,7 +94,8 @@ void ContainerLayer::PaintChildren(PaintContext& context) const { void ContainerLayer::TryToPrepareRasterCache(PrerollContext* context, Layer* layer, const SkMatrix& matrix) { - if (!context->has_platform_view && context->raster_cache && + if (!context->has_platform_view && !context->has_texture_layer && + context->raster_cache && SkRect::Intersects(context->cull_rect, layer->paint_bounds())) { context->raster_cache->Prepare(context, layer, matrix); } diff --git a/engine/src/flutter/flow/layers/layer.h b/engine/src/flutter/flow/layers/layer.h index 7715d5e256..60c949f9d5 100644 --- a/engine/src/flutter/flow/layers/layer.h +++ b/engine/src/flutter/flow/layers/layer.h @@ -64,6 +64,9 @@ struct PrerollContext { // Informs whether a layer needs to be system composited. bool child_scene_layer_exists_below = false; #endif + // These allow us to track properties like elevation, opacity, and the + // prescence of a texture layer during Preroll. + bool has_texture_layer = false; }; // Represents a single composited layer. Created on the UI thread but then diff --git a/engine/src/flutter/flow/layers/texture_layer.cc b/engine/src/flutter/flow/layers/texture_layer.cc index 4c29955f8a..953f9f0670 100644 --- a/engine/src/flutter/flow/layers/texture_layer.cc +++ b/engine/src/flutter/flow/layers/texture_layer.cc @@ -28,6 +28,7 @@ void TextureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { set_paint_bounds(SkRect::MakeXYWH(offset_.x(), offset_.y(), size_.width(), size_.height())); + context->has_texture_layer = true; } void TextureLayer::Paint(PaintContext& context) const {