Skip to content

Commit d229ec8

Browse files
authored
use SkMatrix.invert() instead of MatrixDecomposition to validate cache matrices (flutter#29530)
1 parent fb20916 commit d229ec8

8 files changed

Lines changed: 71 additions & 354 deletions

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ FILE: ../../../flutter/flow/layers/texture_layer_unittests.cc
110110
FILE: ../../../flutter/flow/layers/transform_layer.cc
111111
FILE: ../../../flutter/flow/layers/transform_layer.h
112112
FILE: ../../../flutter/flow/layers/transform_layer_unittests.cc
113-
FILE: ../../../flutter/flow/matrix_decomposition.cc
114-
FILE: ../../../flutter/flow/matrix_decomposition.h
115-
FILE: ../../../flutter/flow/matrix_decomposition_unittests.cc
116113
FILE: ../../../flutter/flow/mutators_stack_unittests.cc
117114
FILE: ../../../flutter/flow/paint_region.cc
118115
FILE: ../../../flutter/flow/paint_region.h

flow/BUILD.gn

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ source_set("flow") {
6060
"layers/texture_layer.h",
6161
"layers/transform_layer.cc",
6262
"layers/transform_layer.h",
63-
"matrix_decomposition.cc",
64-
"matrix_decomposition.h",
6563
"paint_region.cc",
6664
"paint_region.h",
6765
"paint_utils.cc",
@@ -160,7 +158,6 @@ if (enable_unittests) {
160158
"layers/shader_mask_layer_unittests.cc",
161159
"layers/texture_layer_unittests.cc",
162160
"layers/transform_layer_unittests.cc",
163-
"matrix_decomposition_unittests.cc",
164161
"mutators_stack_unittests.cc",
165162
"raster_cache_unittests.cc",
166163
"rtree_unittests.cc",

flow/matrix_decomposition.cc

Lines changed: 0 additions & 128 deletions
This file was deleted.

flow/matrix_decomposition.h

Lines changed: 0 additions & 50 deletions
This file was deleted.

flow/matrix_decomposition_unittests.cc

Lines changed: 0 additions & 159 deletions
This file was deleted.

flow/raster_cache.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,7 @@ bool RasterCache::Prepare(PrerollContext* context,
234234
SkMatrix transformation_matrix = untranslated_matrix;
235235
transformation_matrix.preTranslate(offset.x(), offset.y());
236236

237-
// Decompose the matrix (once) for all subsequent operations. We want to make
238-
// sure to avoid volumetric distortions while accounting for scaling.
239-
const MatrixDecomposition matrix(transformation_matrix);
240-
241-
if (!matrix.IsValid()) {
237+
if (!transformation_matrix.invert(nullptr)) {
242238
// The matrix was singular. No point in going further.
243239
return false;
244240
}
@@ -285,11 +281,7 @@ bool RasterCache::Prepare(PrerollContext* context,
285281
SkMatrix transformation_matrix = untranslated_matrix;
286282
transformation_matrix.preTranslate(offset.x(), offset.y());
287283

288-
// Decompose the matrix (once) for all subsequent operations. We want to make
289-
// sure to avoid volumetric distortions while accounting for scaling.
290-
const MatrixDecomposition matrix(transformation_matrix);
291-
292-
if (!matrix.IsValid()) {
284+
if (!transformation_matrix.invert(nullptr)) {
293285
// The matrix was singular. No point in going further.
294286
return false;
295287
}

0 commit comments

Comments
 (0)