From 0a916d4f14dfab37b2a678715ed3ebe44c67edb4 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 9 Apr 2019 17:34:27 -0700 Subject: [PATCH] Redo a fix for cull rect calculation on TransformLayers with a perspective transform This was originally implemented in https://github.com/flutter/engine/commit/d217a951262df45a9e874403267b9d4bb0d9016c but was not retained when cull rects were removed from the SceneBuilder. Fixes https://github.com/flutter/flutter/issues/30819 --- flow/layers/transform_layer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flow/layers/transform_layer.cc b/flow/layers/transform_layer.cc index 8abb550b95935..b3b259db9e652 100644 --- a/flow/layers/transform_layer.cc +++ b/flow/layers/transform_layer.cc @@ -16,7 +16,9 @@ void TransformLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { SkRect previous_cull_rect = context->cull_rect; SkMatrix inverse_transform_; - if (transform_.invert(&inverse_transform_)) { + // Perspective projections don't produce rectangles that are useful for + // culling for some reason. + if (!transform_.hasPerspective() && transform_.invert(&inverse_transform_)) { inverse_transform_.mapRect(&context->cull_rect); } else { context->cull_rect = kGiantRect;