Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a4775c7

Browse files
authored
Remove strict equality check for SkMatrix comparison (#38665)
* Remove strict equality check for SkMatrix comparison * Address PR comments
1 parent 3d9214a commit a4775c7

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

shell/platform/fuchsia/flutter/gfx_external_view_embedder.cc

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,28 @@ void GfxExternalViewEmbedder::SubmitFrame(
328328
kScenicZElevationBetweenLayers * scenic_layer_index +
329329
embedded_views_height;
330330

331-
if (view_mutators.total_transform != view_params.transformMatrix()) {
332-
FML_LOG(ERROR) << "Failed assertion: view_mutators.total_transform "
333-
"!= view_params.transformMatrix()";
334-
FML_LOG(ERROR) << "view_mutators.total_transform:";
335-
view_mutators.total_transform.dump();
336-
FML_LOG(ERROR) << "view_params.transformMatrix():";
337-
view_params.transformMatrix().dump();
338-
FML_LOG(FATAL) << "view_mutators.total_transform "
339-
"!= view_params.transformMatrix()";
331+
// Verify that we're unpacking the mutators' transform matrix correctly
332+
// on debug builds Use built-in get method for SkMatrix to get values
333+
// See:
334+
// https://source.corp.google.com/piper///depot/google3/third_party/skia/HEAD/include/core/SkMatrix.h;l=391
335+
#ifdef NDEBUG
336+
for (int index = 0; index < 9; index++) {
337+
const SkScalar mutators_transform_value =
338+
view_mutators.total_transform.get(index);
339+
const SkScalar params_transform_value =
340+
view_params.transformMatrix().get(index);
341+
if (!SkScalarNearlyEqual(mutators_transform_value,
342+
params_transform_value, 0.0005f)) {
343+
FML_LOG(FATAL)
344+
<< "Assertion failed: view_mutators.total_transform[" << index
345+
<< "] (" << mutators_transform_value
346+
<< ") != view_params.transformMatrix()[" << index << "] ("
347+
<< params_transform_value
348+
<< "). This likely means there is a bug with the "
349+
<< "logic for parsing embedded views' transform matrices.";
350+
}
340351
}
352+
#endif
341353

342354
// Set clips for the platform view.
343355
if (view_mutators.clips != view_holder.mutators.clips) {

0 commit comments

Comments
 (0)