Skip to content

Commit f2d9065

Browse files
fmalitaSkia Commit-Bot
authored andcommitted
[skottie] Fix analytical mask fill type
Sksg::Merge needs to preserve the fill type of the first path appended in the stack. Theoretically, one could append multiple paths with different fill types using sksg::Merge, but in practice Skottie should never do that (append mode with invertible shape only used for the very first mask in a stack). TBR= Change-Id: Ie9ac9187cc1c8baaae2bef439313a7700407f04a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303582 Reviewed-by: Florin Malita <[email protected]> Commit-Queue: Florin Malita <[email protected]>
1 parent e911ce5 commit f2d9065

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

modules/sksg/src/SkSGMerge.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,26 @@ SkRect Merge::onRevalidate(InvalidationController* ic, const SkMatrix& ctm) {
6868
fMerged.reset();
6969
bool in_builder = false;
7070

71+
auto append = [&](const SkPath& path) {
72+
if (in_builder) {
73+
builder.resolve(&fMerged);
74+
in_builder = false;
75+
}
76+
77+
if (fMerged.isEmpty()) {
78+
// First merge path determines the fill type.
79+
fMerged = path;
80+
} else {
81+
fMerged.addPath(path);
82+
}
83+
};
84+
7185
for (const auto& rec : fRecs) {
7286
rec.fGeo->revalidate(ic, ctm);
7387

74-
// Merge is not currently supported by SkOpBuidler.
7588
if (rec.fMode == Mode::kMerge) {
76-
if (in_builder) {
77-
builder.resolve(&fMerged);
78-
in_builder = false;
79-
}
80-
81-
fMerged.addPath(rec.fGeo->asPath());
89+
// Merge (append) is not supported by SkOpBuidler.
90+
append(rec.fGeo->asPath());
8291
continue;
8392
}
8493

0 commit comments

Comments
 (0)