This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,21 @@ void TransformLayer::Preroll(PrerollContext* context) {
4646 SkRect child_paint_bounds = SkRect::MakeEmpty ();
4747 PrerollChildren (context, &child_paint_bounds);
4848
49+ // We convert to a 3x3 matrix here primarily because the SkM44 object
50+ // does not support a mapRect operation.
51+ // https://bugs.chromium.org/p/skia/issues/detail?id=11720&q=mapRect&can=2
52+ //
53+ // All geometry is X,Y only which means the 3rd row of the 4x4 matrix
54+ // is ignored and the output of the 3rd column is also ignored.
55+ // So we can transform the rectangle using just the 3x3 SkMatrix
56+ // equivalent without any loss of information.
57+ //
58+ // Performance consideration:
59+ // Skia has an internal mapRect for their SkM44 object that is faster
60+ // than what SkMatrix does when it has perspective elements. But SkMatrix
61+ // is otherwise optimal for non-perspective matrices. If SkM44 ever exposes
62+ // a mapRect operation, or if SkMatrix ever optimizes its handling of
63+ // the perspective elements, this issue will become moot.
4964 transform_.asM33 ().mapRect (&child_paint_bounds);
5065 set_paint_bounds (child_paint_bounds);
5166}
You can’t perform that action at this time.
0 commit comments