aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-10-20 13:44:24 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-20 13:44:24 -0700
commit41966d49b0cc9dd2250dac4417ed3b365fb6d704 (patch)
tree18c7877885e4772011776e149488d34ac4598be9
parenta4c4a2d8cd65abb1e5ac20813831cdb9ace6c7ee (diff)
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
-rw-r--r--src/core/SkRecordDraw.cpp6
-rw-r--r--tests/RecordDrawTest.cpp4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 0c3347ec55..12579e9b65 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -473,8 +473,10 @@ private:
#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 51313de9a9..0dfd86a8dd 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -166,8 +166,8 @@ DEF_TEST(RecordDraw_TextBounds, r) {
// 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