Redo a fix for cull rect calculation on TransformLayers with a perspective transform (flutter/engine#8528)

This was originally implemented in 6eab9d08be
but was not retained when cull rects were removed from the SceneBuilder.

Fixes https://github.com/flutter/flutter/issues/30819
This commit is contained in:
Jason Simmons
2019-04-10 13:00:05 -07:00
committed by GitHub
parent 0c481e37ab
commit 5be5c16460

View File

@@ -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;