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

Unified Diff: tests/PictureTest.cpp

Issue 12545009: Adding option in SkPicture to record device-space bounds of draw commands. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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/SkPictureRecord.cpp ('K') | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PictureTest.cpp
===================================================================
--- tests/PictureTest.cpp (revision 9110)
+++ tests/PictureTest.cpp (working copy)
@@ -449,6 +449,39 @@
}
}
+static void test_subregion_playback(skiatest::Reporter* reporter) {
+ // This test verifies early content clipping based on encoded bounds
+ // in SkPicture playback. We verify that content will properly propagate
+ // to the destination canvas in the case where the recorded content is
+ // outside the bounds of the playback canvas, but is brought in-bounds by
+ // a pre-playback transform that is applied to the destination canvas.
+ // In other words, we are verifying that clipping optimizations are
+ // handled in matching frames of reference.
+ SkPicture picture;
+ SkCanvas* recordingCanvas = picture.beginRecording(10, 10);
+ SkPaint paint;
+ paint.setColor(SK_ColorWHITE);
+ SkRect rect = SkRect::MakeXYWH(SkIntToScalar(8), SkIntToScalar(8), SK_Scalar1, SK_Scalar1);
+ recordingCanvas->drawRect(rect, paint);
+ picture.endRecording();
+ SkBitmap store;
+ store.setConfig(SkBitmap::kARGB_8888_Config, 3, 3);
+ store.allocPixels();
+ SkCanvas playbackCanvas(store);
+ playbackCanvas.clear(SK_ColorTRANSPARENT);
+ playbackCanvas.translate(SkIntToScalar(-7), SkIntToScalar(-7));
+ playbackCanvas.drawPicture(picture);
+ for (int x = 0; x < 3; x++) {
+ for (int y = 0; y < 3; y++) {
+ if (1 == x && 1 == y) {
+ REPORTER_ASSERT(reporter, SK_ColorWHITE == store.getColor(x,y));
+ } else {
+ REPORTER_ASSERT(reporter, SK_ColorTRANSPARENT == store.getColor(x,y));
+ }
+ }
+ }
+}
+
static void test_clip_bound_opt(skiatest::Reporter* reporter) {
// Test for crbug.com/229011
SkRect rect1 = SkRect::MakeXYWH(SkIntToScalar(4), SkIntToScalar(4),
@@ -559,6 +592,7 @@
test_gatherpixelrefs(reporter);
test_bitmap_with_encoded_data(reporter);
test_clone_empty(reporter);
+ test_subregion_playback(reporter);
test_clip_bound_opt(reporter);
}
« src/core/SkPictureRecord.cpp ('K') | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698