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
This commit is contained in:
parent
91d844de47
commit
2a5ca89ea1
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user