| Index: tests/PictureBBHTest.cpp
|
| diff --git a/tests/PictureBBHTest.cpp b/tests/PictureBBHTest.cpp
|
| index 3ff5625686b298fdcd99357222d1b9daa066ab9c..2caa4b3886b4543048b264f91c91db4fbf4c0bb3 100644
|
| --- a/tests/PictureBBHTest.cpp
|
| +++ b/tests/PictureBBHTest.cpp
|
| @@ -49,7 +49,9 @@ private:
|
| SkCanvas playbackCanvas(fResultBitmap);
|
| playbackCanvas.clear(SK_ColorGREEN);
|
| SkPictureRecorder recorder;
|
| - SkCanvas* recordCanvas = recorder.beginRecording(SkIntToScalar(fPictureWidth), SkIntToScalar(fPictureHeight), factory);
|
| + SkCanvas* recordCanvas = recorder.beginRecording(SkIntToScalar(fPictureWidth),
|
| + SkIntToScalar(fPictureHeight),
|
| + factory);
|
| this->doTest(playbackCanvas, *recordCanvas);
|
| SkAutoTUnref<SkPicture> picture(recorder.endRecording());
|
| playbackCanvas.drawPicture(picture);
|
| @@ -99,3 +101,37 @@ DEF_TEST(PictureBBH, reporter) {
|
| EmptyClipPictureBBHTest emptyClipPictureTest;
|
| emptyClipPictureTest.run(reporter);
|
| }
|
| +
|
| +static void test_clear(skiatest::Reporter* r, SkBBHFactory* factory) {
|
| + // Make a single red pixel.
|
| + SkBitmap bm;
|
| + bm.allocN32Pixels(1,1);
|
| + SkCanvas dst(bm);
|
| + dst.clear(SK_ColorRED);
|
| +
|
| + // Clip our canvas down to empty.
|
| + dst.clipRect(SkRect::MakeWH(0,0));
|
| +
|
| + // clear() should still set that pixel to true, because it ignores the clip.
|
| + dst.clear(SK_ColorBLUE);
|
| + REPORTER_ASSERT(r, SK_ColorBLUE == bm.getColor(0,0));
|
| +
|
| + // Should also work if we do the draw via an SkPicture.
|
| + SkPictureRecorder rec;
|
| + SkCanvas* src = rec.beginRecording(1,1, factory);
|
| + src->clear(SK_ColorGREEN);
|
| + SkAutoTDelete<SkPicture> pic(rec.endRecording());
|
| + pic->playback(&dst);
|
| + REPORTER_ASSERT(r, SK_ColorGREEN == bm.getColor(0,0));
|
| +}
|
| +
|
| +DEF_TEST(PictureBBH_Clear, r) {
|
| + test_clear(r, NULL);
|
| +
|
| + SkTileGridFactory::TileGridInfo grid = { {1,1}, {0,0}, {0,0} };
|
| + SkTileGridFactory tilegrid(grid);
|
| + test_clear(r, &tilegrid);
|
| +
|
| + SkRTreeFactory rtree;
|
| + test_clear(r, &rtree);
|
| +}
|
|
|