Index: tests/PictureTest.cpp |
=================================================================== |
--- tests/PictureTest.cpp (revision 14237) |
+++ tests/PictureTest.cpp (working copy) |
@@ -303,7 +303,7 @@ |
int count, |
DrawBitmapProc proc) { |
SkPictureRecorder recorder; |
- SkCanvas* canvas = recorder.beginRecording(1000, 1000); |
+ SkCanvas* canvas = recorder.beginRecording(1000, 1000, NULL, 0); |
for (int i = 0; i < count; ++i) { |
analytic[i].rewind(); |
canvas->save(); |
@@ -659,17 +659,17 @@ |
static void test_deleting_empty_playback() { |
SkPictureRecorder recorder; |
// Creates an SkPictureRecord |
- recorder.beginRecording(0, 0); |
+ recorder.beginRecording(0, 0, NULL, 0); |
// Turns that into an SkPicturePlayback |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
// Deletes the old SkPicturePlayback, and creates a new SkPictureRecord |
- recorder.beginRecording(0, 0); |
+ recorder.beginRecording(0, 0, NULL, 0); |
} |
// Ensure that serializing an empty picture does not assert. Likewise only runs in debug mode. |
static void test_serializing_empty_picture() { |
SkPictureRecorder recorder; |
- recorder.beginRecording(0, 0); |
+ recorder.beginRecording(0, 0, NULL, 0); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
SkDynamicMemoryWStream stream; |
picture->serialize(&stream); |
@@ -716,7 +716,7 @@ |
{ |
// Create picture with 2 unbalanced saves |
- SkCanvas* canvas = recorder.beginRecording(100, 100); |
+ SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); |
canvas->save(); |
canvas->translate(10, 10); |
canvas->drawRect(rect, paint); |
@@ -733,7 +733,7 @@ |
{ |
// Create picture with 2 unbalanced restores |
- SkCanvas* canvas = recorder.beginRecording(100, 100); |
+ SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); |
canvas->save(); |
canvas->translate(10, 10); |
canvas->drawRect(rect, paint); |
@@ -753,7 +753,7 @@ |
set_canvas_to_save_count_4(&testCanvas); |
{ |
- SkCanvas* canvas = recorder.beginRecording(100, 100); |
+ SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); |
canvas->translate(10, 10); |
canvas->drawRect(rect, paint); |
SkAutoTUnref<SkPicture> noSavePicture(recorder.endRecording()); |
@@ -772,7 +772,7 @@ |
for (int j = 0; j < 100; j++) { |
SkRandom rand2(rand); // remember the seed |
- SkCanvas* canvas = recorder.beginRecording(100, 100); |
+ SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); |
for (int i = 0; i < 1000; ++i) { |
rand_op(canvas, rand); |
@@ -783,7 +783,7 @@ |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(100, 100); |
+ SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); |
SkRect rect = SkRect::MakeWH(50, 50); |
for (int i = 0; i < 100; ++i) { |
@@ -806,7 +806,7 @@ |
SkBitmap bm; |
bm.setConfig(SkImageInfo::MakeN32Premul(100, 100)); |
SkPictureRecorder recorder; |
- SkCanvas* recordingCanvas = recorder.beginRecording(100, 100); |
+ SkCanvas* recordingCanvas = recorder.beginRecording(100, 100, NULL, 0); |
recordingCanvas->drawBitmap(bm, 0, 0); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
@@ -821,7 +821,7 @@ |
static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) { |
SkPictureRecorder recorder; |
- SkCanvas* canvas = recorder.beginRecording(bitmap.width(), bitmap.height()); |
+ SkCanvas* canvas = recorder.beginRecording(bitmap.width(), bitmap.height(), NULL, 0); |
canvas->drawBitmap(bitmap, 0, 0); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
@@ -887,7 +887,7 @@ |
// had a picture with no paints. This test passes by not crashing. |
{ |
SkPictureRecorder recorder; |
- recorder.beginRecording(1, 1); |
+ recorder.beginRecording(1, 1, NULL, 0); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
SkAutoTUnref<SkPicture> destPicture(picture->clone()); |
REPORTER_ASSERT(reporter, NULL != destPicture); |
@@ -903,7 +903,7 @@ |
{ |
// stock SkPicture |
SkPictureRecorder recorder; |
- recorder.beginRecording(1, 1); |
+ recorder.beginRecording(1, 1, NULL, 0); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
canvas.drawPicture(*picture); |
@@ -911,14 +911,14 @@ |
{ |
// tile grid |
- SkTileGridPicture::TileGridInfo gridInfo; |
+ SkTileGridFactory::TileGridInfo gridInfo; |
gridInfo.fMargin.setEmpty(); |
gridInfo.fOffset.setZero(); |
gridInfo.fTileInterval.set(1, 1); |
- SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (gridInfo))); |
- SkPictureRecorder recorder(factory); |
- recorder.beginRecording(1, 1); |
+ SkTileGridFactory factory(gridInfo); |
+ SkPictureRecorder recorder; |
+ recorder.beginRecording(1, 1, &factory, 0); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
canvas.drawPicture(*picture); |
@@ -926,9 +926,9 @@ |
{ |
// RTree |
- SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkRTreePictureFactory)); |
- SkPictureRecorder recorder(factory); |
- recorder.beginRecording(1, 1); |
+ SkRTreeFactory factory; |
+ SkPictureRecorder recorder; |
+ recorder.beginRecording(1, 1, &factory, 0); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
canvas.drawPicture(*picture); |
@@ -936,9 +936,9 @@ |
{ |
// quad tree |
- SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkQuadTreePictureFactory)); |
- SkPictureRecorder recorder(factory); |
- recorder.beginRecording(1, 1); |
+ SkQuadTreeFactory factory; |
+ SkPictureRecorder recorder; |
+ recorder.beginRecording(1, 1, &factory, 0); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
canvas.drawPicture(*picture); |
@@ -966,7 +966,7 @@ |
// Minimalist test set for 100% code coverage of |
// SkPictureRecord::updateClipConservativelyUsingBounds |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(invPath, SkRegion::kIntersect_Op); |
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); |
@@ -977,7 +977,7 @@ |
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight); |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kIntersect_Op); |
canvas->clipPath(invPath, SkRegion::kIntersect_Op); |
@@ -989,7 +989,7 @@ |
REPORTER_ASSERT(reporter, 8 == clipBounds.fRight); |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kIntersect_Op); |
canvas->clipPath(invPath, SkRegion::kUnion_Op); |
@@ -1001,7 +1001,7 @@ |
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight); |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kDifference_Op); |
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); |
@@ -1012,7 +1012,7 @@ |
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight); |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kReverseDifference_Op); |
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); |
@@ -1026,7 +1026,7 @@ |
REPORTER_ASSERT(reporter, 8 == clipBounds.fRight); |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kIntersect_Op); |
canvas->clipPath(path2, SkRegion::kXOR_Op); |
@@ -1085,7 +1085,7 @@ |
static void test_clip_expansion(skiatest::Reporter* reporter) { |
SkPictureRecorder recorder; |
- SkCanvas* canvas = recorder.beginRecording(10, 10, 0); |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0); |
canvas->clipRect(SkRect::MakeEmpty(), SkRegion::kReplace_Op); |
// The following expanding clip should not be skipped. |
@@ -1109,35 +1109,35 @@ |
SkPictureRecorder recorder; |
- recorder.beginRecording(10, 10); |
+ recorder.beginRecording(10, 10, NULL, 0); |
SkAutoTUnref<SkPicture> childPlain(recorder.endRecording()); |
REPORTER_ASSERT(reporter, !childPlain->willPlayBackBitmaps()); // 0 |
- recorder.beginRecording(10, 10)->drawBitmap(bm, 0, 0); |
+ recorder.beginRecording(10, 10, NULL, 0)->drawBitmap(bm, 0, 0); |
SkAutoTUnref<SkPicture> childWithBitmap(recorder.endRecording()); |
REPORTER_ASSERT(reporter, childWithBitmap->willPlayBackBitmaps()); // 1 |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10); |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0); |
canvas->drawPicture(*childPlain); |
SkAutoTUnref<SkPicture> parentPP(recorder.endRecording()); |
REPORTER_ASSERT(reporter, !parentPP->willPlayBackBitmaps()); // 0 |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10); |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0); |
canvas->drawPicture(*childWithBitmap); |
SkAutoTUnref<SkPicture> parentPWB(recorder.endRecording()); |
REPORTER_ASSERT(reporter, parentPWB->willPlayBackBitmaps()); // 1 |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10); |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0); |
canvas->drawBitmap(bm, 0, 0); |
canvas->drawPicture(*childPlain); |
SkAutoTUnref<SkPicture> parentWBP(recorder.endRecording()); |
REPORTER_ASSERT(reporter, parentWBP->willPlayBackBitmaps()); // 1 |
} |
{ |
- SkCanvas* canvas = recorder.beginRecording(10, 10); |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0); |
canvas->drawBitmap(bm, 0, 0); |
canvas->drawPicture(*childWithBitmap); |
SkAutoTUnref<SkPicture> parentWBWB(recorder.endRecording()); |
@@ -1154,7 +1154,7 @@ |
SkPictureRecorder recorder; |
- SkCanvas* canvas = recorder.beginRecording(1, 1); |
+ SkCanvas* canvas = recorder.beginRecording(1, 1, NULL, 0); |
canvas->drawARGB(255, 255, 255, 255); |
SkAutoTUnref<SkPicture> hasData(recorder.endRecording()); |
// picture should have a non-zero id after recording |
@@ -1232,7 +1232,7 @@ |
DEF_TEST(Picture_EmptyBitmap, r) { |
SkPictureRecorder recorder; |
- test_draw_bitmaps(recorder.beginRecording(10, 10)); |
+ test_draw_bitmaps(recorder.beginRecording(10, 10, NULL, 0)); |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
} |