| 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);
|
| }
|
|
|
|
|