Index: tests/PictureTest.cpp |
=================================================================== |
--- tests/PictureTest.cpp (revision 14159) |
+++ tests/PictureTest.cpp (working copy) |
@@ -301,8 +301,8 @@ |
SkTDArray<SkPixelRef*> analytic[], |
int count, |
DrawBitmapProc proc) { |
- SkPicture* pic = new SkPicture; |
- SkCanvas* canvas = pic->beginRecording(1000, 1000); |
+ SkPictureRecorder recorder; |
+ SkCanvas* canvas = recorder.beginRecording(1000, 1000); |
for (int i = 0; i < count; ++i) { |
analytic[i].rewind(); |
canvas->save(); |
@@ -313,8 +313,7 @@ |
proc(canvas, bm[i], bm[count+i], pos[i], &analytic[i]); |
canvas->restore(); |
} |
- pic->endRecording(); |
- return pic; |
+ return recorder.endRecording(); |
} |
static void rand_rect(SkRect* rect, SkRandom& rand, SkScalar W, SkScalar H) { |
@@ -657,22 +656,22 @@ |
// Ensure that deleting SkPicturePlayback does not assert. Asserts only fire in debug mode, so only |
// run in debug mode. |
static void test_deleting_empty_playback() { |
- SkPicture picture; |
+ SkPictureRecorder recorder; |
// Creates an SkPictureRecord |
- picture.beginRecording(0, 0); |
+ recorder.beginRecording(0, 0); |
// Turns that into an SkPicturePlayback |
- picture.endRecording(); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
// Deletes the old SkPicturePlayback, and creates a new SkPictureRecord |
- picture.beginRecording(0, 0); |
+ recorder.beginRecording(0, 0); |
} |
// Ensure that serializing an empty picture does not assert. Likewise only runs in debug mode. |
static void test_serializing_empty_picture() { |
- SkPicture picture; |
- picture.beginRecording(0, 0); |
- picture.endRecording(); |
+ SkPictureRecorder recorder; |
+ recorder.beginRecording(0, 0); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
SkDynamicMemoryWStream stream; |
- picture.serialize(&stream); |
+ picture->serialize(&stream); |
} |
#endif |
@@ -712,66 +711,78 @@ |
SkPaint paint; |
SkRect rect = SkRect::MakeLTRB(-10000000, -10000000, 10000000, 10000000); |
- SkPicture extra_save_picture; |
- extra_save_picture.beginRecording(100, 100); |
- extra_save_picture.getRecordingCanvas()->save(); |
- extra_save_picture.getRecordingCanvas()->translate(10, 10); |
- extra_save_picture.getRecordingCanvas()->drawRect(rect, paint); |
- extra_save_picture.getRecordingCanvas()->save(); |
- extra_save_picture.getRecordingCanvas()->translate(10, 10); |
- extra_save_picture.getRecordingCanvas()->drawRect(rect, paint); |
+ SkPictureRecorder recorder; |
- testCanvas.drawPicture(extra_save_picture); |
- REPORTER_ASSERT(reporter, 4 == testCanvas.getSaveCount()); |
+ { |
+ // Create picture with 2 unbalanced saves |
+ SkCanvas* canvas = recorder.beginRecording(100, 100); |
+ canvas->save(); |
+ canvas->translate(10, 10); |
+ canvas->drawRect(rect, paint); |
+ canvas->save(); |
+ canvas->translate(10, 10); |
+ canvas->drawRect(rect, paint); |
+ SkAutoTUnref<SkPicture> extraSavePicture(recorder.endRecording()); |
+ testCanvas.drawPicture(*extraSavePicture); |
+ REPORTER_ASSERT(reporter, 4 == testCanvas.getSaveCount()); |
+ } |
+ |
set_canvas_to_save_count_4(&testCanvas); |
- SkPicture extra_restore_picture; |
- extra_restore_picture.beginRecording(100, 100); |
- extra_restore_picture.getRecordingCanvas()->save(); |
- extra_restore_picture.getRecordingCanvas()->translate(10, 10); |
- extra_restore_picture.getRecordingCanvas()->drawRect(rect, paint); |
- extra_restore_picture.getRecordingCanvas()->save(); |
- extra_restore_picture.getRecordingCanvas()->translate(10, 10); |
- extra_restore_picture.getRecordingCanvas()->drawRect(rect, paint); |
- extra_restore_picture.getRecordingCanvas()->restore(); |
- extra_restore_picture.getRecordingCanvas()->restore(); |
- extra_restore_picture.getRecordingCanvas()->restore(); |
- extra_restore_picture.getRecordingCanvas()->restore(); |
+ { |
+ // Create picture with 2 unbalanced restores |
+ SkCanvas* canvas = recorder.beginRecording(100, 100); |
+ canvas->save(); |
+ canvas->translate(10, 10); |
+ canvas->drawRect(rect, paint); |
+ canvas->save(); |
+ canvas->translate(10, 10); |
+ canvas->drawRect(rect, paint); |
+ canvas->restore(); |
+ canvas->restore(); |
+ canvas->restore(); |
+ canvas->restore(); |
+ SkAutoTUnref<SkPicture> extraRestorePicture(recorder.endRecording()); |
- testCanvas.drawPicture(extra_save_picture); |
- REPORTER_ASSERT(reporter, 4 == testCanvas.getSaveCount()); |
+ testCanvas.drawPicture(*extraRestorePicture); |
+ REPORTER_ASSERT(reporter, 4 == testCanvas.getSaveCount()); |
+ } |
- SkPicture no_save_picture; |
- extra_restore_picture.beginRecording(100, 100); |
- extra_restore_picture.getRecordingCanvas()->translate(10, 10); |
- extra_restore_picture.getRecordingCanvas()->drawRect(rect, paint); |
+ set_canvas_to_save_count_4(&testCanvas); |
- testCanvas.drawPicture(extra_save_picture); |
- REPORTER_ASSERT(reporter, 4 == testCanvas.getSaveCount()); |
- REPORTER_ASSERT(reporter, testCanvas.getTotalMatrix().isIdentity()); |
+ { |
+ SkCanvas* canvas = recorder.beginRecording(100, 100); |
+ canvas->translate(10, 10); |
+ canvas->drawRect(rect, paint); |
+ SkAutoTUnref<SkPicture> noSavePicture(recorder.endRecording()); |
+ |
+ testCanvas.drawPicture(*noSavePicture); |
+ REPORTER_ASSERT(reporter, 4 == testCanvas.getSaveCount()); |
+ REPORTER_ASSERT(reporter, testCanvas.getTotalMatrix().isIdentity()); |
+ } |
} |
static void test_peephole() { |
SkRandom rand; |
+ SkPictureRecorder recorder; |
+ |
for (int j = 0; j < 100; j++) { |
SkRandom rand2(rand); // remember the seed |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(100, 100); |
+ SkCanvas* canvas = recorder.beginRecording(100, 100); |
for (int i = 0; i < 1000; ++i) { |
rand_op(canvas, rand); |
} |
- picture.endRecording(); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
rand = rand2; |
} |
{ |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(100, 100); |
+ SkCanvas* canvas = recorder.beginRecording(100, 100); |
SkRect rect = SkRect::MakeWH(50, 50); |
for (int i = 0; i < 100; ++i) { |
@@ -781,7 +792,7 @@ |
canvas->clipRect(rect); |
canvas->restore(); |
} |
- picture.endRecording(); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
} |
} |
@@ -793,13 +804,13 @@ |
// fail. |
SkBitmap bm; |
bm.setConfig(SkImageInfo::MakeN32Premul(100, 100)); |
- SkPicture picture; |
- SkCanvas* recordingCanvas = picture.beginRecording(100, 100); |
+ SkPictureRecorder recorder; |
+ SkCanvas* recordingCanvas = recorder.beginRecording(100, 100); |
recordingCanvas->drawBitmap(bm, 0, 0); |
- picture.endRecording(); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
SkCanvas canvas; |
- canvas.drawPicture(picture); |
+ canvas.drawPicture(*picture); |
} |
#endif |
@@ -808,11 +819,13 @@ |
} |
static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) { |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(bitmap.width(), bitmap.height()); |
+ SkPictureRecorder recorder; |
+ SkCanvas* canvas = recorder.beginRecording(bitmap.width(), bitmap.height()); |
canvas->drawBitmap(bitmap, 0, 0); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
+ |
SkDynamicMemoryWStream wStream; |
- picture.serialize(&wStream, &encode_bitmap_to_data); |
+ picture->serialize(&wStream, &encode_bitmap_to_data); |
return wStream.copyToData(); |
} |
@@ -872,21 +885,12 @@ |
// Before the fix, we used to crash accessing a null pointer when we |
// had a picture with no paints. This test passes by not crashing. |
{ |
- SkPicture picture; |
- picture.beginRecording(1, 1); |
- picture.endRecording(); |
- SkPicture* destPicture = picture.clone(); |
+ SkPictureRecorder recorder; |
+ recorder.beginRecording(1, 1); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
+ SkAutoTUnref<SkPicture> destPicture(picture->clone()); |
REPORTER_ASSERT(reporter, NULL != destPicture); |
- destPicture->unref(); |
} |
- { |
- // Test without call to endRecording |
- SkPicture picture; |
- picture.beginRecording(1, 1); |
- SkPicture* destPicture = picture.clone(); |
- REPORTER_ASSERT(reporter, NULL != destPicture); |
- destPicture->unref(); |
- } |
} |
static void test_draw_empty(skiatest::Reporter* reporter) { |
@@ -897,11 +901,11 @@ |
{ |
// stock SkPicture |
- SkPicture picture; |
- picture.beginRecording(1, 1); |
- picture.endRecording(); |
+ SkPictureRecorder recorder; |
+ recorder.beginRecording(1, 1); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
- canvas.drawPicture(picture); |
+ canvas.drawPicture(*picture); |
} |
{ |
@@ -911,29 +915,31 @@ |
gridInfo.fOffset.setZero(); |
gridInfo.fTileInterval.set(1, 1); |
- SkTileGridPicture picture(1, 1, gridInfo); |
- picture.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
- picture.endRecording(); |
+ SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (gridInfo))); |
+ SkPictureRecorder recorder(factory); |
+ recorder.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
- canvas.drawPicture(picture); |
+ canvas.drawPicture(*picture); |
} |
{ |
// RTree |
- SkPicture picture; |
- picture.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
- picture.endRecording(); |
+ SkPictureRecorder recorder; |
+ recorder.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
- canvas.drawPicture(picture); |
+ canvas.drawPicture(*picture); |
} |
{ |
// quad tree |
- SkQuadTreePicture picture(SkIRect::MakeWH(1, 1)); |
- picture.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
- picture.endRecording(); |
+ SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkQuadTreePictureFactory)); |
+ SkPictureRecorder recorder(factory); |
+ recorder.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
- canvas.drawPicture(picture); |
+ canvas.drawPicture(*picture); |
} |
} |
@@ -954,11 +960,11 @@ |
SkPath path2; |
path2.addOval(rect3); |
SkIRect clipBounds; |
+ SkPictureRecorder recorder; |
// Minimalist test set for 100% code coverage of |
// SkPictureRecord::updateClipConservativelyUsingBounds |
{ |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(invPath, SkRegion::kIntersect_Op); |
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); |
@@ -969,8 +975,7 @@ |
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight); |
} |
{ |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kIntersect_Op); |
canvas->clipPath(invPath, SkRegion::kIntersect_Op); |
@@ -982,8 +987,7 @@ |
REPORTER_ASSERT(reporter, 8 == clipBounds.fRight); |
} |
{ |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kIntersect_Op); |
canvas->clipPath(invPath, SkRegion::kUnion_Op); |
@@ -995,8 +999,7 @@ |
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight); |
} |
{ |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kDifference_Op); |
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); |
@@ -1007,8 +1010,7 @@ |
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight); |
} |
{ |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kReverseDifference_Op); |
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); |
@@ -1022,8 +1024,7 @@ |
REPORTER_ASSERT(reporter, 8 == clipBounds.fRight); |
} |
{ |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(10, 10, |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, |
SkPicture::kUsePathBoundsForClip_RecordingFlag); |
canvas->clipPath(path, SkRegion::kIntersect_Op); |
canvas->clipPath(path2, SkRegion::kXOR_Op); |
@@ -1081,8 +1082,8 @@ |
}; |
static void test_clip_expansion(skiatest::Reporter* reporter) { |
- SkPicture picture; |
- SkCanvas* canvas = picture.beginRecording(10, 10, 0); |
+ SkPictureRecorder recorder; |
+ SkCanvas* canvas = recorder.beginRecording(10, 10, 0); |
canvas->clipRect(SkRect::MakeEmpty(), SkRegion::kReplace_Op); |
// The following expanding clip should not be skipped. |
@@ -1091,9 +1092,10 @@ |
SkPaint p; |
p.setColor(SK_ColorBLUE); |
canvas->drawPaint(p); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
ClipCountingCanvas testCanvas(10, 10); |
- picture.draw(&testCanvas); |
+ picture->draw(&testCanvas); |
// Both clips should be present on playback. |
REPORTER_ASSERT(reporter, testCanvas.getClipCount() == 2); |
@@ -1103,95 +1105,87 @@ |
SkBitmap bm; |
make_bm(&bm, 10, 10, SK_ColorRED, true); |
- SkCanvas* canvas; |
+ SkPictureRecorder recorder; |
- SkPicture childPlain; |
- childPlain.beginRecording(10, 10); |
- childPlain.endRecording(); |
- REPORTER_ASSERT(reporter, !childPlain.willPlayBackBitmaps()); // 0 |
+ recorder.beginRecording(10, 10); |
+ SkAutoTUnref<SkPicture> childPlain(recorder.endRecording()); |
+ REPORTER_ASSERT(reporter, !childPlain->willPlayBackBitmaps()); // 0 |
- SkPicture childWithBitmap; |
- childWithBitmap.beginRecording(10, 10)->drawBitmap(bm, 0, 0); |
- childWithBitmap.endRecording(); |
- REPORTER_ASSERT(reporter, childWithBitmap.willPlayBackBitmaps()); // 1 |
+ recorder.beginRecording(10, 10)->drawBitmap(bm, 0, 0); |
+ SkAutoTUnref<SkPicture> childWithBitmap(recorder.endRecording()); |
+ REPORTER_ASSERT(reporter, childWithBitmap->willPlayBackBitmaps()); // 1 |
- SkPicture parentPP; |
- canvas = parentPP.beginRecording(10, 10); |
- canvas->drawPicture(childPlain); |
- parentPP.endRecording(); |
- REPORTER_ASSERT(reporter, !parentPP.willPlayBackBitmaps()); // 0 |
- |
- SkPicture parentPWB; |
- canvas = parentPWB.beginRecording(10, 10); |
- canvas->drawPicture(childWithBitmap); |
- parentPWB.endRecording(); |
- REPORTER_ASSERT(reporter, parentPWB.willPlayBackBitmaps()); // 1 |
- |
- SkPicture parentWBP; |
- canvas = parentWBP.beginRecording(10, 10); |
- canvas->drawBitmap(bm, 0, 0); |
- canvas->drawPicture(childPlain); |
- parentWBP.endRecording(); |
- REPORTER_ASSERT(reporter, parentWBP.willPlayBackBitmaps()); // 1 |
- |
- SkPicture parentWBWB; |
- canvas = parentWBWB.beginRecording(10, 10); |
- canvas->drawBitmap(bm, 0, 0); |
- canvas->drawPicture(childWithBitmap); |
- parentWBWB.endRecording(); |
- REPORTER_ASSERT(reporter, parentWBWB.willPlayBackBitmaps()); // 2 |
+ { |
+ SkCanvas* canvas = recorder.beginRecording(10, 10); |
+ canvas->drawPicture(*childPlain); |
+ SkAutoTUnref<SkPicture> parentPP(recorder.endRecording()); |
+ REPORTER_ASSERT(reporter, !parentPP->willPlayBackBitmaps()); // 0 |
+ } |
+ { |
+ SkCanvas* canvas = recorder.beginRecording(10, 10); |
+ canvas->drawPicture(*childWithBitmap); |
+ SkAutoTUnref<SkPicture> parentPWB(recorder.endRecording()); |
+ REPORTER_ASSERT(reporter, parentPWB->willPlayBackBitmaps()); // 1 |
+ } |
+ { |
+ SkCanvas* canvas = recorder.beginRecording(10, 10); |
+ 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); |
+ canvas->drawBitmap(bm, 0, 0); |
+ canvas->drawPicture(*childWithBitmap); |
+ SkAutoTUnref<SkPicture> parentWBWB(recorder.endRecording()); |
+ REPORTER_ASSERT(reporter, parentWBWB->willPlayBackBitmaps()); // 2 |
+ } |
} |
static void test_gen_id(skiatest::Reporter* reporter) { |
- SkPicture hasData, empty, midRecord; |
+ SkPicture empty; |
- uint32_t beforeID = hasData.uniqueID(); |
- REPORTER_ASSERT(reporter, SK_InvalidGenID != beforeID); |
+ // Empty pictures should still have a valid ID |
+ REPORTER_ASSERT(reporter, empty.uniqueID() != SK_InvalidGenID); |
- // all 3 pictures should have different ids |
- REPORTER_ASSERT(reporter, beforeID != empty.uniqueID()); |
- REPORTER_ASSERT(reporter, beforeID != midRecord.uniqueID()); |
- REPORTER_ASSERT(reporter, empty.uniqueID() != midRecord.uniqueID()); |
+ SkPictureRecorder recorder; |
- hasData.beginRecording(1, 1); |
- // gen ID should be invalid mid-record |
- REPORTER_ASSERT(reporter, SK_InvalidGenID == hasData.uniqueID()); |
- hasData.endRecording(); |
- // picture should get a new (non-zero) id after recording |
- REPORTER_ASSERT(reporter, hasData.uniqueID() != beforeID); |
- REPORTER_ASSERT(reporter, hasData.uniqueID() != SK_InvalidGenID); |
+ SkCanvas* canvas = recorder.beginRecording(1, 1); |
+ canvas->drawARGB(255, 255, 255, 255); |
+ SkAutoTUnref<SkPicture> hasData(recorder.endRecording()); |
+ // picture should have a non-zero id after recording |
+ REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID); |
- midRecord.beginRecording(1, 1); |
- REPORTER_ASSERT(reporter, SK_InvalidGenID == midRecord.uniqueID()); |
+ // both pictures should have different ids |
+ REPORTER_ASSERT(reporter, hasData->uniqueID() != empty.uniqueID()); |
// test out copy constructor |
- SkPicture copyWithData(hasData); |
- REPORTER_ASSERT(reporter, hasData.uniqueID() == copyWithData.uniqueID()); |
+ SkPicture copyWithData(*hasData); |
+ REPORTER_ASSERT(reporter, hasData->uniqueID() == copyWithData.uniqueID()); |
SkPicture emptyCopy(empty); |
REPORTER_ASSERT(reporter, empty.uniqueID() != emptyCopy.uniqueID()); |
- SkPicture copyMidRecord(midRecord); |
- REPORTER_ASSERT(reporter, midRecord.uniqueID() != copyMidRecord.uniqueID()); |
- REPORTER_ASSERT(reporter, copyMidRecord.uniqueID() != SK_InvalidGenID); |
- |
// test out swap |
- beforeID = copyMidRecord.uniqueID(); |
- copyWithData.swap(copyMidRecord); |
- REPORTER_ASSERT(reporter, copyWithData.uniqueID() == beforeID); |
- REPORTER_ASSERT(reporter, copyMidRecord.uniqueID() == hasData.uniqueID()); |
+ { |
+ SkPicture swapWithData; |
+ uint32_t beforeID1 = swapWithData.uniqueID(); |
+ uint32_t beforeID2 = copyWithData.uniqueID(); |
+ swapWithData.swap(copyWithData); |
+ REPORTER_ASSERT(reporter, copyWithData.uniqueID() == beforeID1); |
+ REPORTER_ASSERT(reporter, swapWithData.uniqueID() == beforeID2); |
+ } |
// test out clone |
- SkAutoTUnref<SkPicture> cloneWithData(hasData.clone()); |
- REPORTER_ASSERT(reporter, hasData.uniqueID() == cloneWithData->uniqueID()); |
+ { |
+ SkAutoTUnref<SkPicture> cloneWithData(hasData->clone()); |
+ REPORTER_ASSERT(reporter, hasData->uniqueID() == cloneWithData->uniqueID()); |
- SkAutoTUnref<SkPicture> emptyClone(empty.clone()); |
- REPORTER_ASSERT(reporter, empty.uniqueID() != emptyClone->uniqueID()); |
- |
- SkAutoTUnref<SkPicture> cloneMidRecord(midRecord.clone()); |
- REPORTER_ASSERT(reporter, midRecord.uniqueID() != cloneMidRecord->uniqueID()); |
- REPORTER_ASSERT(reporter, cloneMidRecord->uniqueID() != SK_InvalidGenID); |
+ SkAutoTUnref<SkPicture> emptyClone(empty.clone()); |
+ REPORTER_ASSERT(reporter, empty.uniqueID() != emptyClone->uniqueID()); |
+ } |
} |
DEF_TEST(Picture, reporter) { |
@@ -1235,9 +1229,9 @@ |
} |
DEF_TEST(Picture_EmptyBitmap, r) { |
- SkPicture picture; |
- test_draw_bitmaps(picture.beginRecording(10, 10)); |
- picture.endRecording(); |
+ SkPictureRecorder recorder; |
+ test_draw_bitmaps(recorder.beginRecording(10, 10)); |
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
} |
DEF_TEST(Canvas_EmptyBitmap, r) { |