diff options
author | mtklein <mtklein@chromium.org> | 2014-10-29 08:12:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-29 08:12:08 -0700 |
commit | bf8dc343df4fbdcb8af546eb68b640e011a33489 (patch) | |
tree | 9aeb3fa4454ea36ae39102a88cffedad83c0efc5 /tests/RecordDrawTest.cpp | |
parent | 6d5b5455743414ddb11d2b8c1fe9d7959f2b853d (diff) |
Use SkTypeface::getBounds() in bounding-box calculations.
This should produce tighter conservative bounding boxes for text than the
approximation code it replaces.
Recording performance is neutral on my desktop. Playback performance
improves by up to 15% on text heavy pages, e.g.
desk_pokemonwiki.skp_1 3.24ms -> 2.83ms 0.87x
desk_baidu.skp_1 1.91ms -> 1.58ms 0.83x
Review URL: https://codereview.chromium.org/680363003
Diffstat (limited to 'tests/RecordDrawTest.cpp')
-rw-r--r-- | tests/RecordDrawTest.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp index 6105c00f7f..2476c03984 100644 --- a/tests/RecordDrawTest.cpp +++ b/tests/RecordDrawTest.cpp @@ -166,11 +166,11 @@ DEF_TEST(RecordDraw_TextBounds, r) { SkRecordFillBounds(record, &bbh); REPORTER_ASSERT(r, bbh.fEntries.count() == 2); - // 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(-110, 0, 140, 60))); - REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(-80, 20, 180, 100))); + // Font metrics are somewhat platform dependent. These assertions may need to be adjusted. + // However, these particular numbers are left over from the days when we used to wildly + // overestimate font metrics, so these assertions should be pretty conservative. + REPORTER_ASSERT(r, SkRect::MakeLTRB(-110, 0, 140, 60) .contains(bbh.fEntries[0].bounds)); + REPORTER_ASSERT(r, SkRect::MakeLTRB(-80, 20, 180, 100).contains(bbh.fEntries[1].bounds)); } // Base test to ensure start/stop range is respected |