Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: tests/RecordDrawTest.cpp

Issue 696763002: Shrink saveLayer device bounds when it supplies an explicit bounds and has a complex paint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/core/SkRecordDraw.cpp ('K') | « src/core/SkRecordDraw.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RecordDrawTest.cpp
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index 6105c00f7f1093842d9fc2e808a753f2c7595f7b..6147eac80988171d907ae7f9d3cc2bf95753f191 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -137,7 +137,7 @@ DEF_TEST(RecordDraw_BBH, r) {
recorder.restore();
TestBBH bbh;
- SkRecordFillBounds(record, &bbh);
+ SkRecordFillBounds(SkRect::MakeWH(SkIntToScalar(W), SkIntToScalar(H)), record, &bbh);
REPORTER_ASSERT(r, bbh.fEntries.count() == 5);
for (int i = 0; i < bbh.fEntries.count(); i++) {
@@ -163,14 +163,14 @@ DEF_TEST(RecordDraw_TextBounds, r) {
recorder.drawPosText(text, bytes, pos, SkPaint());
TestBBH bbh;
- SkRecordFillBounds(record, &bbh);
+ SkRecordFillBounds(SkRect::MakeWH(SkIntToScalar(W), SkIntToScalar(H)), 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)));
+ REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(0, 0, 140, 60)));
+ REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(0, 20, 180, 100)));
}
// Base test to ensure start/stop range is respected
@@ -251,7 +251,7 @@ DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) {
// The second bug showed up as adjusting the picture bounds (0,0,50,50) by the drop shadow too.
// The saveLayer, clipRect, and restore bounds were incorrectly (0,0,70,50).
TestBBH bbh;
- SkRecordFillBounds(record, &bbh);
+ SkRecordFillBounds(SkRect::MakeWH(50, 50), record, &bbh);
REPORTER_ASSERT(r, bbh.fEntries.count() == 4);
REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(0, 0, 50, 50)));
REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(0, 0, 50, 50)));
« src/core/SkRecordDraw.cpp ('K') | « src/core/SkRecordDraw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698