From 90b9b7a455d9153ed4632f06abe8d352d9f5abea Mon Sep 17 00:00:00 2001 From: Michael Ludwig Date: Fri, 31 May 2024 16:38:32 -0400 Subject: [PATCH] Remove SK_RESOLVE_FILTERS_BEFORE_RESTORE flag (flutter/engine#49563) Update SaveLayerConsolidation unit tests to allow 1px differences due to rounding differences when Skia elides image filter passes and can calculate the CF and opacity in full float without an intermediate conversion to 8-bit color. This is the last remaining use of the staging that will allow closing https://g-issues.skia.org/issues/40042615. *List which issues are fixed by this PR. You must list at least one issue.* *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../testing/dl_rendering_unittests.cc | 23 +++++++++++++------ engine/src/flutter/skia/flutter_defines.gni | 1 - 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/engine/src/flutter/display_list/testing/dl_rendering_unittests.cc b/engine/src/flutter/display_list/testing/dl_rendering_unittests.cc index 91023c00b3..6e9b235482 100644 --- a/engine/src/flutter/display_list/testing/dl_rendering_unittests.cc +++ b/engine/src/flutter/display_list/testing/dl_rendering_unittests.cc @@ -2650,7 +2650,7 @@ class CanvasCompareTester { static void compareToReference(const RenderResult* test_result, const RenderResult* ref_result, const std::string& info, - SkRect* bounds, + const SkRect* bounds, const BoundsTolerance* tolerance, const DlColor bg, bool fuzzyCompares = false, @@ -3960,15 +3960,24 @@ TEST_F(DisplayListRendering, SaveLayerConsolidation) { // when we claim that they are compatible and they aren't. const bool always = false; + // In some circumstances, Skia can combine image filter evaluations + // and elide a renderpass. In this case rounding and precision of inputs + // to color filters may cause the output to differ by 1. if (always || same) { - CanvasCompareTester::quickCompareToReference( - nested_results.get(), combined_results.get(), same, - "nested " + desc1 + " then " + desc2); + CanvasCompareTester::compareToReference( + nested_results.get(), combined_results.get(), + "nested " + desc1 + " then " + desc2, /*bounds=*/nullptr, + /*tolerance=*/nullptr, DlColor::kTransparent(), + /*fuzzyCompares=*/true, combined_results->width(), + combined_results->height(), /*printMismatches=*/true); } if (always || rev_same) { - CanvasCompareTester::quickCompareToReference( - reverse_results.get(), combined_results.get(), rev_same, - "nested " + desc2 + " then " + desc1); + CanvasCompareTester::compareToReference( + reverse_results.get(), combined_results.get(), + "nested " + desc2 + " then " + desc1, /*bounds=*/nullptr, + /*tolerance=*/nullptr, DlColor::kTransparent(), + /*fuzzyCompares=*/true, combined_results->width(), + combined_results->height(), /*printMismatches=*/true); } }; diff --git a/engine/src/flutter/skia/flutter_defines.gni b/engine/src/flutter/skia/flutter_defines.gni index f3a5fc623b..83e6433ab8 100644 --- a/engine/src/flutter/skia/flutter_defines.gni +++ b/engine/src/flutter/skia/flutter_defines.gni @@ -11,7 +11,6 @@ flutter_defines = [ # Staging "SK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER", - "SK_RESOLVE_FILTERS_BEFORE_RESTORE", "SK_DISABLE_LEGACY_METAL_BACKEND_SURFACE", "SK_DISABLE_LEGACY_PARAGRAPH_UNICODE",