diff --git a/flutter_frontend_server/test/to_string_test.dart b/flutter_frontend_server/test/to_string_test.dart index ded3b98362730..53957fdae1b78 100644 --- a/flutter_frontend_server/test/to_string_test.dart +++ b/flutter_frontend_server/test/to_string_test.dart @@ -45,7 +45,9 @@ Future main(List args) async { ])); final ProcessResult runResult = Process.runSync(dart, [regularDill]); checkProcessResult(runResult); - String paintString = '"Paint.toString":"Paint(Color(0xffffffff))"'; + // TODO(matanlurey): "dither: true" is now present by default, until it is + // remove entirely. See https://github.com/flutter/flutter/issues/112498. + String paintString = '"Paint.toString":"Paint(Color(0xffffffff); dither: true)"'; if (buildDir.contains('release')) { paintString = '"Paint.toString":"Instance of \'Paint\'"'; } diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 2849c4b1c178a..03d32b97cbc90 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -1487,22 +1487,19 @@ class Paint { _data.setInt32(_kDitherOffset, value ? 1 : 0, _kFakeHostEndian); } - /// Whether to dither the output when drawing images. - /// - /// If false, the default value, dithering will be enabled when the input - /// color depth is higher than the output color depth. For example, - /// drawing an RGB8 image onto an RGB565 canvas. - /// - /// This value also controls dithering of [shader]s, which can make - /// gradients appear smoother. - /// - /// Whether or not dithering affects the output is implementation defined. - /// Some implementations may choose to ignore this completely, if they're - /// unable to control dithering. - /// - /// To ensure that dithering is consistently enabled for your entire - /// application, set this to true before invoking any drawing related code. - static bool enableDithering = false; + /// Whether to dither the output when drawing some elements such as gradients. + /// + /// It is not expected that this flag will be used in the future; please leave + /// feedback in if there is + /// a use case for this flag to remain long term. + @Deprecated( + 'Dithering is now enabled by default on some elements (such as gradients) ' + 'and further support for dithering is expected to be handled by custom ' + 'shaders, so this flag is being removed: ' + 'https://github.com/flutter/flutter/issues/112498.' + 'This feature was deprecated after 3.14.0-0.1.pre.' + ) + static bool enableDithering = true; @override String toString() { diff --git a/shell/platform/embedder/fixtures/dpr_noxform.png b/shell/platform/embedder/fixtures/dpr_noxform.png index 807e3996e3b10..ba557532583c3 100644 Binary files a/shell/platform/embedder/fixtures/dpr_noxform.png and b/shell/platform/embedder/fixtures/dpr_noxform.png differ diff --git a/shell/platform/embedder/fixtures/dpr_xform.png b/shell/platform/embedder/fixtures/dpr_xform.png index eaea6487b0eb2..12e48fae67a4f 100644 Binary files a/shell/platform/embedder/fixtures/dpr_xform.png and b/shell/platform/embedder/fixtures/dpr_xform.png differ diff --git a/shell/platform/embedder/fixtures/gradient.png b/shell/platform/embedder/fixtures/gradient.png index fc291444ffaa1..c4ae3b511f879 100644 Binary files a/shell/platform/embedder/fixtures/gradient.png and b/shell/platform/embedder/fixtures/gradient.png differ diff --git a/shell/platform/embedder/fixtures/gradient_xform.png b/shell/platform/embedder/fixtures/gradient_xform.png index bed63b525d59d..575a82c27aafd 100644 Binary files a/shell/platform/embedder/fixtures/gradient_xform.png and b/shell/platform/embedder/fixtures/gradient_xform.png differ diff --git a/shell/platform/embedder/fixtures/verifyb143464703_soft_noxform.png b/shell/platform/embedder/fixtures/verifyb143464703_soft_noxform.png index 38097bf97b876..e18fc3769b342 100644 Binary files a/shell/platform/embedder/fixtures/verifyb143464703_soft_noxform.png and b/shell/platform/embedder/fixtures/verifyb143464703_soft_noxform.png differ diff --git a/shell/platform/embedder/fixtures/vk_dpr_noxform.png b/shell/platform/embedder/fixtures/vk_dpr_noxform.png index d6afead4802a9..0689f1a414b1e 100644 Binary files a/shell/platform/embedder/fixtures/vk_dpr_noxform.png and b/shell/platform/embedder/fixtures/vk_dpr_noxform.png differ diff --git a/shell/platform/embedder/fixtures/vk_gradient.png b/shell/platform/embedder/fixtures/vk_gradient.png index 6c4c7ba39990b..540bd8d66db9b 100644 Binary files a/shell/platform/embedder/fixtures/vk_gradient.png and b/shell/platform/embedder/fixtures/vk_gradient.png differ diff --git a/testing/dart/canvas_test.dart b/testing/dart/canvas_test.dart index 451beaf243af5..716233fa8a783 100644 --- a/testing/dart/canvas_test.dart +++ b/testing/dart/canvas_test.dart @@ -203,6 +203,10 @@ void main() { } test('Simple gradient', () async { + // TODO(matanl): While deprecated, we still don't want to accidentally + // change the behavior of the old API, + // https://github.com/flutter/flutter/issues/112498. + // ignore: deprecated_member_use Paint.enableDithering = false; final Image image = await toImage((Canvas canvas) { final Paint paint = Paint()..shader = makeGradient(); @@ -217,6 +221,8 @@ void main() { }, skip: !Platform.isLinux); // https://github.com/flutter/flutter/issues/53784 test('Simple dithered gradient', () async { + // TODO(matanl): Reword this test once we remove the deprecated API. + // ignore: deprecated_member_use Paint.enableDithering = true; final Image image = await toImage((Canvas canvas) { final Paint paint = Paint()..shader = makeGradient();