Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: src/record/SkRecordDraw.cpp

Issue 235983015: SkRecord bug fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tomments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/record/SkRecords.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/record/SkRecordDraw.cpp
diff --git a/src/record/SkRecordDraw.cpp b/src/record/SkRecordDraw.cpp
index f0d3772e9fbbc426d57b100481a09ab39234154b..c6e85502a7c6d5db7ff0ef92ee83967fbc545f78 100644
--- a/src/record/SkRecordDraw.cpp
+++ b/src/record/SkRecordDraw.cpp
@@ -76,7 +76,7 @@ CAN_SKIP(ClipRegion);
static bool can_skip_text(const SkCanvas& c, const SkPaint& p, SkScalar minY, SkScalar maxY) {
// If we're drawing vertical text, none of the checks we're about to do make any sense.
- // We use canComputeFastBounds as a proxy for "is this text going to be rectangular?".
+ // We'll need to call SkPaint::computeFastBounds() later, so bail out if that's not possible.
if (p.isVerticalText() || !p.canComputeFastBounds()) {
return false;
}
@@ -88,7 +88,13 @@ static bool can_skip_text(const SkCanvas& c, const SkPaint& p, SkScalar minY, Sk
SkDEBUGCODE(p.getFontMetrics(&metrics);)
SkASSERT(-buffer <= metrics.fTop);
SkASSERT(+buffer >= metrics.fBottom);
- return c.quickRejectY(minY - buffer, maxY + buffer);
+
+ // Let the paint adjust the text bounds. We don't care about left and right here, so we use
+ // 0 and 1 respectively just so the bounds rectangle isn't empty.
+ SkRect bounds;
+ bounds.set(0, -buffer, SK_Scalar1, buffer);
+ SkRect adjusted = p.computeFastBounds(bounds, &bounds);
+ return c.quickRejectY(minY + adjusted.fTop, maxY + adjusted.fBottom);
}
template <> bool Draw::canSkip(const SkRecords::DrawPosTextH& r) const {
« no previous file with comments | « no previous file | src/record/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698