diff options
author | egdaniel <egdaniel@google.com> | 2015-08-10 11:02:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-10 11:02:46 -0700 |
commit | 2a5ca89ea1a5093b5d143740619ca162a74fe0e7 (patch) | |
tree | 60b70a76077587e98469f0f77e74b29cae2d3691 /src/core | |
parent | 91d844de47bdc1c3f807c85293e46943dcfc712d (diff) |
Revert of [TextBlob] Fall back to TightRunBounds when the font bounds are empty (patchset #1 id:1 of https://codereview.chromium.org/1284693002/ )
Reason for revert:
Breaking DEPS roll on Assert in SkTextBlobBuilder::TightRunBounds.
Original issue's description:
> [TextBlob] Fall back to TightRunBounds when the font bounds are empty
>
> Empty font bounds are likely an indication of a font bug. As a best
> effort, we can use TightRunBounds in this easily detectable case.
>
> BUG=507022
> R=reed@google.com,bungeman@google.com
>
> Committed: https://skia.googlesource.com/skia/+/d6b99cc6b84b3ec864221cbe9945d203bd9eb072
TBR=bungeman@google.com,reed@google.com,fmalita@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=507022
Review URL: https://codereview.chromium.org/1283853002
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkTextBlob.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp index 4ba7df8a7d..d1a77e74f7 100644 --- a/src/core/SkTextBlob.cpp +++ b/src/core/SkTextBlob.cpp @@ -382,16 +382,7 @@ SkRect SkTextBlobBuilder::ConservativeRunBounds(const SkTextBlob::RunRecord& run SkASSERT(SkTextBlob::kFull_Positioning == run.positioning() || SkTextBlob::kHorizontal_Positioning == run.positioning()); - SkPaint paint; - run.font().applyToPaint(&paint); - const SkRect fontBounds = paint.getFontBounds(); - if (fontBounds.isEmpty()) { - // Empty font bounds are likely a font bug. TightBounds has a better chance of - // producing useful results in this case. - return TightRunBounds(run); - } - - // Compute the glyph position bbox. + // First, compute the glyph position bbox. SkRect bounds; switch (run.positioning()) { case SkTextBlob::kHorizontal_Positioning: { @@ -419,6 +410,9 @@ SkRect SkTextBlobBuilder::ConservativeRunBounds(const SkTextBlob::RunRecord& run } // Expand by typeface glyph bounds. + SkPaint paint; + run.font().applyToPaint(&paint); + const SkRect fontBounds = paint.getFontBounds(); bounds.fLeft += fontBounds.left(); bounds.fTop += fontBounds.top(); bounds.fRight += fontBounds.right(); |