This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Skia] Only respect ui.Paint.dither when the colorSource is a gradient #44730
Merged
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
92a4e5c
Initial try at gradient-only-dithering for the Sk backend.
matanlurey 3fe2554
Licenses and GN.
matanlurey 839610d
Allow calling ToSk from other files (i.e. unittests).
matanlurey 760944f
Clang format.
matanlurey a1e1fe7
Remove unittests that test general dithering behavior.
matanlurey af290e9
Tweak based on Jim's suggestions.
matanlurey 51bc62a
Merge branch 'main' into engine-sk-dither-guard
matanlurey 5f191b4
Merge branch 'main' into engine-sk-dither-guard
matanlurey bfefb9a
Remove dead code and duplication of code.
matanlurey c01ac64
Address comments.
matanlurey 4903aa0
Address comments.
matanlurey 2ccbf58
Merge remote-tracking branch 'upstream/main' into engine-sk-dither-guard
matanlurey 0156b57
Move SkPaint ToSk to dl_sk_conversions for consistency.
matanlurey d1dd861
Merge branch 'main' into engine-sk-dither-guard
matanlurey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include "display_list/dl_tile_mode.h" | ||
| #include "display_list/effects/dl_color_source.h" | ||
| #include "flutter/display_list/dl_paint.h" | ||
| #include "flutter/display_list/skia/dl_sk_canvas.h" | ||
|
|
||
| #include "gtest/gtest.h" | ||
|
|
||
| namespace flutter { | ||
| namespace testing { | ||
|
|
||
| TEST(DisplayListSkCanvas, ToSkDitheringDisabled) { | ||
| // Test that when using the utility method "ToSk", the resulting SkPaint | ||
| // does not have "isDither" set to true, even if it's requested by the | ||
| // Flutter (dart:ui) paint, because it's not a supported feature in the | ||
| // Impeller backend. | ||
|
|
||
| // Create a new DlPaint with isDither set to true. | ||
| // | ||
| // This mimics the behavior of ui.Paint.enableDithering = true. | ||
| DlPaint dl_paint; | ||
| dl_paint.setDither(true); | ||
|
|
||
| SkPaint sk_paint = ToSk(dl_paint); | ||
|
|
||
| EXPECT_FALSE(sk_paint.isDither()); | ||
| } | ||
|
|
||
| TEST(DisplayListSkCanvas, ToSkDitheringEnabledForGradients) { | ||
| // Test that when using the utility method "ToSk", the resulting SkPaint | ||
| // has "isDither" set to true, if the paint is a gradient, because it's | ||
| // a supported feature in the Impeller backend. | ||
|
|
||
| // Create a new DlPaint with isDither set to true. | ||
| // | ||
| // This mimics the behavior of ui.Paint.enableDithering = true. | ||
| DlPaint dl_paint; | ||
| dl_paint.setDither(true); | ||
|
|
||
| // Set the paint to be a gradient. | ||
| dl_paint.setColorSource(DlColorSource::MakeLinear(SkPoint::Make(0, 0), | ||
| SkPoint::Make(100, 100), 0, | ||
| 0, 0, DlTileMode::kClamp)); | ||
|
|
||
| SkPaint sk_paint = ToSk(dl_paint); | ||
|
|
||
| EXPECT_TRUE(sk_paint.isDither()); | ||
| } | ||
|
|
||
| } // namespace testing | ||
| } // namespace flutter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.