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

Commit 3969746

Browse files
herbderbySkia Commit-Bot
authored andcommitted
clip more cases using the CPU allowing more op merges
In desk_gmail.skp, the clips are marked as AA, but are actually integer bounds. Check for this case and clip using the CPU. The big benefit for this is that during op merging the applied clips are nullptr, which allows many more cases to merge. Change-Id: Idd000c325da60767b18e22a20cb4afa1c0dd798f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335052 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
1 parent 07f675d commit 3969746

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/gpu/text/GrTextBlob.cpp

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -621,19 +621,29 @@ DirectMaskSubRun::makeAtlasTextOp(const GrClip* clip, const SkMatrixProvider& vi
621621
// If the SubRun is completely outside, don't add an op for it.
622622
return {nullptr, nullptr};
623623
} else if (clip != nullptr) {
624-
const GrClip::PreClipResult result = clip->preApply(subRunBounds, GrAA::kNo);
625-
if (result.fEffect == GrClip::Effect::kClipped) {
626-
if (result.fIsRRect && result.fRRect.isRect() && result.fAA == GrAA::kNo) {
627-
// Clip geometrically during onPrepare using clipRect.
628-
result.fRRect.getBounds().round(&clipRect);
629-
if (clipRect.contains(subRunBounds)) {
630-
// If fully within the clip, then signal no clipping using the empty rect.
631-
clipRect = SkIRect::MakeEmpty();
632-
}
624+
switch (auto result = clip->preApply(subRunBounds, GrAA::kNo); result.fEffect) {
625+
case GrClip::Effect::kClippedOut:
626+
// Return nullptr op to indicate no op needed.
627+
return {nullptr, nullptr};
628+
case GrClip::Effect::kUnclipped:
629+
clipRect = SkIRect::MakeEmpty();
633630
clip = nullptr;
631+
break;
632+
case GrClip::Effect::kClipped: {
633+
if (result.fIsRRect && result.fRRect.isRect()) {
634+
SkRect r = result.fRRect.rect();
635+
if (result.fAA == GrAA::kNo || GrClip::IsPixelAligned(r)) {
636+
// Clip geometrically during onPrepare using clipRect.
637+
r.round(&clipRect);
638+
if (clipRect.contains(subRunBounds)) {
639+
// If fully within the clip, signal no clipping using the empty rect.
640+
clipRect = SkIRect::MakeEmpty();
641+
}
642+
clip = nullptr;
643+
}
644+
}
634645
}
635-
} else if (result.fEffect == GrClip::Effect::kClippedOut) {
636-
return {nullptr, nullptr};
646+
break;
637647
}
638648
}
639649

0 commit comments

Comments
 (0)