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

Unified Diff: tests/RecordDrawTest.cpp

Issue 778563002: Revert "Change clear() to respect the clip" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « tests/DeferredCanvasTest.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 30be24c28acbc567dc4ad6691ff9001e6c46a371..48981ef0a208a1554810833f0c04ed59acc5cc4b 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -191,7 +191,7 @@ DEF_TEST(RecordDraw_PartialStartStop, r) {
SkRecord rerecord;
SkRecorder canvas(&rerecord, kWidth, kHeight);
- SkRecordPartialDraw(record, &canvas, NULL, 0, 1, 2, SkMatrix::I()); // replay just drawRect of r2
+ SkRecordPartialDraw(record, &canvas, NULL, 0, r1, 1, 2, SkMatrix::I()); // replay just drawRect of r2
REPORTER_ASSERT(r, 3 == rerecord.count());
assert_type<SkRecords::Save> (r, rerecord, 0);
@@ -202,6 +202,30 @@ DEF_TEST(RecordDraw_PartialStartStop, r) {
REPORTER_ASSERT(r, drawRect->rect == r2);
}
+// Check that clears are converted to drawRects
+DEF_TEST(RecordDraw_PartialClear, r) {
+ static const int kWidth = 10, kHeight = 10;
+
+ SkRect rect = { 0, 0, kWidth, kHeight };
+
+ SkRecord record;
+ SkRecorder recorder(&record, kWidth, kHeight);
+ recorder.clear(SK_ColorRED);
+
+ SkRecord rerecord;
+ SkRecorder canvas(&rerecord, kWidth, kHeight);
+ SkRecordPartialDraw(record, &canvas, NULL, 0, rect, 0, 1, SkMatrix::I()); // replay just the clear
+
+ REPORTER_ASSERT(r, 3 == rerecord.count());
+ assert_type<SkRecords::Save> (r, rerecord, 0);
+ assert_type<SkRecords::DrawRect>(r, rerecord, 1);
+ assert_type<SkRecords::Restore> (r, rerecord, 2);
+
+ const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, rerecord, 1);
+ REPORTER_ASSERT(r, drawRect->rect == rect);
+ REPORTER_ASSERT(r, drawRect->paint.getColor() == SK_ColorRED);
+}
+
// A regression test for crbug.com/415468 and skbug.com/2957.
//
// This also now serves as a regression test for crbug.com/418417. We used to adjust the
« no previous file with comments | « tests/DeferredCanvasTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698