Dilate approximated text bounds to squelch recent assertion failure.
This is once again an issue related to logo fonts, so I don't
see any easy way to add a regression test for this.
BUG=424824
Review URL: https://codereview.chromium.org/665103002
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 0c3347e..12579e9 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -473,8 +473,10 @@
#ifdef SK_DEBUG
SkRect correct = *rect;
#endif
- const SkScalar yPad = 2.0f * paint.getTextSize(), // In practice, this seems to be enough.
- xPad = 4.0f * yPad; // Hack for very wide Github logo font.
+ // crbug.com/373785 ~~> xPad = 4x yPad
+ // crbug.com/424824 ~~> bump yPad from 2x text size to 2.5x
+ const SkScalar yPad = 2.5f * paint.getTextSize(),
+ xPad = 4.0f * yPad;
rect->outset(xPad, yPad);
#ifdef SK_DEBUG
SkPaint::FontMetrics metrics;
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index 51313de..0dfd86a 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -166,8 +166,8 @@
// We can make these next assertions confidently because SkRecordFillBounds
// builds its bounds by overestimating font metrics in a platform-independent way.
// If that changes, these tests will need to be more flexible.
- REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(-86, 6, 116, 54)));
- REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(-56, 26, 156, 94)));
+ REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(-110, 0, 140, 60)));
+ REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(-80, 20, 180, 100)));
}
// Base test to ensure start/stop range is respected