Skip to content

Commit

Permalink
use SkMatrix.invert() instead of MatrixDecomposition to validate cach…
Browse files Browse the repository at this point in the history
…e matrices (flutter#29530)
  • Loading branch information
flar authored Nov 4, 2021
1 parent fb20916 commit d229ec8
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 354 deletions.
3 changes: 0 additions & 3 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ FILE: ../../../flutter/flow/layers/texture_layer_unittests.cc
FILE: ../../../flutter/flow/layers/transform_layer.cc
FILE: ../../../flutter/flow/layers/transform_layer.h
FILE: ../../../flutter/flow/layers/transform_layer_unittests.cc
FILE: ../../../flutter/flow/matrix_decomposition.cc
FILE: ../../../flutter/flow/matrix_decomposition.h
FILE: ../../../flutter/flow/matrix_decomposition_unittests.cc
FILE: ../../../flutter/flow/mutators_stack_unittests.cc
FILE: ../../../flutter/flow/paint_region.cc
FILE: ../../../flutter/flow/paint_region.h
Expand Down
3 changes: 0 additions & 3 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ source_set("flow") {
"layers/texture_layer.h",
"layers/transform_layer.cc",
"layers/transform_layer.h",
"matrix_decomposition.cc",
"matrix_decomposition.h",
"paint_region.cc",
"paint_region.h",
"paint_utils.cc",
Expand Down Expand Up @@ -160,7 +158,6 @@ if (enable_unittests) {
"layers/shader_mask_layer_unittests.cc",
"layers/texture_layer_unittests.cc",
"layers/transform_layer_unittests.cc",
"matrix_decomposition_unittests.cc",
"mutators_stack_unittests.cc",
"raster_cache_unittests.cc",
"rtree_unittests.cc",
Expand Down
128 changes: 0 additions & 128 deletions flow/matrix_decomposition.cc

This file was deleted.

50 changes: 0 additions & 50 deletions flow/matrix_decomposition.h

This file was deleted.

159 changes: 0 additions & 159 deletions flow/matrix_decomposition_unittests.cc

This file was deleted.

12 changes: 2 additions & 10 deletions flow/raster_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,7 @@ bool RasterCache::Prepare(PrerollContext* context,
SkMatrix transformation_matrix = untranslated_matrix;
transformation_matrix.preTranslate(offset.x(), offset.y());

// Decompose the matrix (once) for all subsequent operations. We want to make
// sure to avoid volumetric distortions while accounting for scaling.
const MatrixDecomposition matrix(transformation_matrix);

if (!matrix.IsValid()) {
if (!transformation_matrix.invert(nullptr)) {
// The matrix was singular. No point in going further.
return false;
}
Expand Down Expand Up @@ -285,11 +281,7 @@ bool RasterCache::Prepare(PrerollContext* context,
SkMatrix transformation_matrix = untranslated_matrix;
transformation_matrix.preTranslate(offset.x(), offset.y());

// Decompose the matrix (once) for all subsequent operations. We want to make
// sure to avoid volumetric distortions while accounting for scaling.
const MatrixDecomposition matrix(transformation_matrix);

if (!matrix.IsValid()) {
if (!transformation_matrix.invert(nullptr)) {
// The matrix was singular. No point in going further.
return false;
}
Expand Down
Loading

0 comments on commit d229ec8

Please sign in to comment.