Change SkPicture::draw to playback

R=reed@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/540963002
This commit is contained in:
robertphillips 2014-09-04 08:42:50 -07:00 коммит произвёл Commit bot
Родитель 227c54e3d4
Коммит c5ba71d2e5
31 изменённых файлов: 93 добавлений и 81 удалений

Просмотреть файл

@ -46,7 +46,7 @@ protected:
const SkPoint translateDelta = getTranslateDelta(loops);
for (int i = 0; i < loops; i++) {
picture->draw(canvas);
picture->playback(canvas);
canvas->translate(translateDelta.fX, translateDelta.fY);
}
}

Просмотреть файл

@ -30,7 +30,7 @@ void SKPBench::onDraw(const int loops, SkCanvas* canvas) {
canvas->save();
canvas->scale(fScale, fScale);
for (int i = 0; i < loops; i++) {
fPic->draw(canvas);
fPic->playback(canvas);
canvas->flush();
}
canvas->restore();

Просмотреть файл

@ -491,9 +491,9 @@ public:
};
SkTileGridFactory factory(info);
SkPictureRecorder recorder;
pic->draw(recorder.beginRecording(pic->cullRect().width(),
pic->cullRect().height(),
&factory));
pic->playback(recorder.beginRecording(pic->cullRect().width(),
pic->cullRect().height(),
&factory));
pic.reset(recorder.endRecording());
}

Просмотреть файл

@ -31,7 +31,7 @@ void SkDebugger::loadPicture(SkPicture* picture) {
fDebugCanvas = new SkDebugCanvas(SkScalarCeilToInt(this->pictureCull().width()),
SkScalarCeilToInt(this->pictureCull().height()));
fDebugCanvas->setPicture(picture);
picture->draw(fDebugCanvas);
picture->playback(fDebugCanvas);
fDebugCanvas->setPicture(NULL);
fIndex = fDebugCanvas->getSize() - 1;
}

Просмотреть файл

@ -77,7 +77,7 @@ void PDFTask::draw() {
pdfData.reset(pdf.end());
} else {
SinglePagePDF pdf(fPicture->cullRect().width(), fPicture->cullRect().height());
fPicture->draw(pdf.canvas());
fPicture->playback(pdf.canvas());
pdfData.reset(pdf.end());
}

Просмотреть файл

@ -46,7 +46,7 @@ public:
SkCanvas tileCanvas(tile);
tileCanvas.translate(SkIntToScalar(-fX), SkIntToScalar(-fY));
fPicture.draw(&tileCanvas);
fPicture.playback(&tileCanvas);
tileCanvas.flush();
delete this;
@ -92,7 +92,7 @@ void QuiltTask::draw() {
if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) {
// Some GMs don't draw exactly the same when tiled. Draw them in one go.
SkCanvas canvas(full);
recorded->draw(&canvas);
recorded->playback(&canvas);
canvas.flush();
} else {
// Draw tiles in parallel into the same bitmap, simulating aggressive impl-side painting.

Просмотреть файл

@ -152,7 +152,7 @@ static void server(const char* dataEndpoint, const char* controlEndpoint, SkCanv
canvas->saveLayer(NULL, &paint);
canvas->concat(header.matrix);
canvas->clipRect(header.clip);
picture->draw(canvas);
picture->playback(canvas);
canvas->restore();
SkDebugf(" drew");

Просмотреть файл

@ -46,15 +46,15 @@ protected:
SkAutoTUnref<SkPicture> pict(recorder.endRecording());
// Next we play that picture into another picture of the same size.
pict->draw(recorder.beginRecording(pict->cullRect().width(),
pict->cullRect().height(),
NULL, 0));
pict->playback(recorder.beginRecording(pict->cullRect().width(),
pict->cullRect().height(),
NULL, 0));
SkAutoTUnref<SkPicture> pict2(recorder.endRecording());
// Finally we play the part of that second picture that should be green into the canvas.
canvas->save();
canvas->translate(kExtents / 2, -(kOffset - kExtents / 2));
pict2->draw(canvas);
pict2->playback(canvas);
canvas->restore();
// If the image is red, we erroneously decided the clipPath was empty and didn't record

Просмотреть файл

@ -633,7 +633,7 @@ public:
mat.postTranslate(SkIntToScalar(-xTile*tileSize.width()),
SkIntToScalar(-yTile*tileSize.height()));
tileCanvas.setMatrix(mat);
pict->draw(&tileCanvas);
pict->playback(&tileCanvas);
tileCanvas.flush();
tileCanvas.restoreToCount(saveCount);
bmpCanvas.drawBitmap(tileBM,

Просмотреть файл

@ -19,7 +19,7 @@
static bool check_pattern(SkPicture& input, const SkTDArray<DrawType> &pattern) {
SkDebugCanvas debugCanvas(SkScalarCeilToInt(input.cullRect().width()),
SkScalarCeilToInt(input.cullRect().height()));
input.draw(&debugCanvas);
input.playback(&debugCanvas);
if (pattern.count() != debugCanvas.getSize()) {
return false;
@ -352,7 +352,7 @@ protected:
canvas->save();
canvas->translate(xPos, yPos);
pre->draw(canvas);
pre->playback(canvas);
xPos += pre->cullRect().width();
canvas->restore();
@ -364,7 +364,7 @@ protected:
pre->cullRect().height(),
NULL, 0);
pre->draw(recordCanvas);
pre->playback(recordCanvas);
SkAutoTUnref<SkPicture> post(recorder.endRecording());
@ -375,7 +375,7 @@ protected:
canvas->save();
canvas->translate(xPos, yPos);
post->draw(canvas);
post->playback(canvas);
xPos += post->cullRect().width();
canvas->restore();

Просмотреть файл

@ -21,6 +21,7 @@
# Transitional, for deprecated SkCanvas::SaveFlags methods.
'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
'SK_LEGACY_PICTURE_SIZE_API',
'SK_LEGACY_PICTURE_DRAW_API',
],
},
}

Просмотреть файл

@ -20,6 +20,7 @@
'SK_IGNORE_GPU_DITHER',
'SK_SUPPORT_LEGACY_IMAGECACHE_NAME',
'SK_LEGACY_PICTURE_SIZE_API',
'SK_LEGACY_PICTURE_DRAW_API',
],
},
}

Просмотреть файл

@ -111,10 +111,20 @@ public:
SkPicture* clone() const;
#endif
/** Replays the drawing commands on the specified canvas.
/** Replays the drawing commands on the specified canvas. Note that
this has the effect of unfurling this picture into the destination
canvas. Using the SkCanvas::drawPicture entry point gives the destination
canvas the option of just taking a ref.
@param canvas the canvas receiving the drawing commands.
@param callback a callback that allows interruption of playback
*/
void draw(SkCanvas* canvas, SkDrawPictureCallback* = NULL) const;
void playback(SkCanvas* canvas, SkDrawPictureCallback* = NULL) const;
#ifdef SK_LEGACY_PICTURE_DRAW_API
void draw(SkCanvas* canvas, SkDrawPictureCallback* callback = NULL) const {
this->playback(canvas, callback);
}
#endif
#ifdef SK_LEGACY_PICTURE_SIZE_API
int width() const { return SkScalarCeilToInt(fCullWidth); }

Просмотреть файл

@ -322,7 +322,7 @@ protected:
do {
canvas->save();
canvas->clipRect(clip);
picture->draw(canvas);
picture->playback(canvas);
canvas->restore();
if (clip.fRight < SkIntToScalar(320))
clip.offset(SkIntToScalar(160), 0);

Просмотреть файл

@ -1376,7 +1376,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
orig->drawPicture(pict.get());
}
} else {
picture->draw(orig);
picture->playback(orig);
}
}

Просмотреть файл

@ -144,9 +144,9 @@ private:
}
if (false) { // re-record
SkPictureRecorder recorder;
pic->draw(recorder.beginRecording(pic->cullRect().width(),
pic->cullRect().height(),
NULL, 0));
pic->playback(recorder.beginRecording(pic->cullRect().width(),
pic->cullRect().height(),
NULL, 0));
SkAutoTUnref<SkPicture> p2(recorder.endRecording());
SkString path2(path);
@ -182,9 +182,9 @@ private:
}
SkPictureRecorder recorder;
pic->draw(recorder.beginRecording(pic->cullRect().width(),
pic->cullRect().height(),
factory.get(), 0));
pic->playback(recorder.beginRecording(pic->cullRect().width(),
pic->cullRect().height(),
factory.get(), 0));
return recorder.endRecording();
}

Просмотреть файл

@ -2455,7 +2455,7 @@ void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
picture->draw(this);
picture->playback(this);
}
///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -327,7 +327,7 @@ const SkMatrix& SkPicture::OperationList::matrix(int index) const {
}
// fRecord OK
void SkPicture::draw(SkCanvas* canvas, SkDrawPictureCallback* callback) const {
void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) const {
SkASSERT(NULL != canvas);
SkASSERT(NULL != fData.get() || NULL != fRecord.get());
@ -459,7 +459,7 @@ SkPicture::SkPicture(SkPictureData* data, SkScalar width, SkScalar height)
SkPicture* SkPicture::Forwardport(const SkPicture& src) {
SkAutoTDelete<SkRecord> record(SkNEW(SkRecord));
SkRecorder canvas(record.get(), src.cullRect().width(), src.cullRect().height());
src.draw(&canvas);
src.playback(&canvas);
return SkNEW_ARGS(SkPicture, (src.cullRect().width(), src.cullRect().height(),
record.detach(), NULL/*bbh*/));
}

Просмотреть файл

@ -108,6 +108,6 @@ void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
const bool deepCopyOps = true;
SkPicture picture(fCullWidth, fCullHeight,
*fPictureRecord.get(), deepCopyOps);
picture.draw(canvas);
picture.playback(canvas);
}
}

Просмотреть файл

@ -400,7 +400,7 @@ static SkMSec timePict(SkPicture* pic, SkCanvas* canvas) {
SkMSec start = SkTime::GetMSecs();
for (int x = 0; x < slices; ++x) {
for (int y = 0; y < slices; ++y) {
pic->draw(canvas);
pic->playback(canvas);
canvas->translate(0, yInterval);
}
canvas->translate(xInterval, -yInterval * slices);
@ -416,7 +416,7 @@ static void drawPict(SkPicture* pic, SkCanvas* canvas, int scale) {
canvas->save();
canvas->scale(1.0f / scale, 1.0f / scale);
}
pic->draw(canvas);
pic->playback(canvas);
if (scale != 1) {
canvas->restore();
}

Просмотреть файл

@ -1191,7 +1191,7 @@ void check_save_state(skiatest::Reporter* reporter, SkPicture* picture,
SaveCountingCanvas canvas(SkScalarCeilToInt(picture->cullRect().width()),
SkScalarCeilToInt(picture->cullRect().height()));
picture->draw(&canvas);
picture->playback(&canvas);
REPORTER_ASSERT(reporter, numSaves == canvas.getSaveCount());
REPORTER_ASSERT(reporter, numSaveLayers == canvas.getSaveLayerCount());
@ -1693,7 +1693,7 @@ static void test_clip_expansion(skiatest::Reporter* reporter) {
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
ClipCountingCanvas testCanvas(10, 10);
picture->draw(&testCanvas);
picture->playback(&testCanvas);
// Both clips should be present on playback.
REPORTER_ASSERT(reporter, testCanvas.getClipCount() == 2);
@ -1866,7 +1866,7 @@ DEF_TEST(DontOptimizeSaveLayerDrawDrawRestore, reporter) {
SkBitmap replayBM;
make_bm(&replayBM, 100, 100, SK_ColorBLACK, false);
SkCanvas replayCanvas(replayBM);
picture->draw(&replayCanvas);
picture->playback(&replayCanvas);
replayCanvas.flush();
// With the bug present, at (55, 55) we would get a fully opaque red
@ -1914,10 +1914,10 @@ DEF_TEST(Picture_SkipBBH, r) {
SkCanvas big(640, 480), small(300, 200);
picture->draw(&big);
picture->playback(&big);
REPORTER_ASSERT(r, bbh.searchCalls == 0);
picture->draw(&small);
picture->playback(&small);
REPORTER_ASSERT(r, bbh.searchCalls == 1);
}

Просмотреть файл

@ -266,7 +266,7 @@ static SkBitmap draw_picture(SkPicture& picture) {
bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()),
SkScalarCeilToInt(picture.cullRect().height()));
SkCanvas canvas(bitmap);
picture.draw(&canvas);
picture.playback(&canvas);
return bitmap;
}

Просмотреть файл

@ -73,14 +73,14 @@ DEF_TEST(TileGrid_UnalignedQuery, reporter) {
// Test parts of top-left tile
{
MockCanvas mockCanvas(store);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
}
{
MockCanvas mockCanvas(store);
mockCanvas.translate(-7.99f, -7.99f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
}
@ -88,7 +88,7 @@ DEF_TEST(TileGrid_UnalignedQuery, reporter) {
{
MockCanvas mockCanvas(store);
mockCanvas.translate(-9.5f, -9.5f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 2 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[1]);
@ -97,7 +97,7 @@ DEF_TEST(TileGrid_UnalignedQuery, reporter) {
{
MockCanvas mockCanvas(store);
mockCanvas.translate(-16.0f, -16.0f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]);
}
@ -105,28 +105,28 @@ DEF_TEST(TileGrid_UnalignedQuery, reporter) {
{
MockCanvas mockCanvas(store);
mockCanvas.translate(2.0f, 0.0f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
}
{
MockCanvas mockCanvas(store);
mockCanvas.translate(0.0f, 2.0f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
}
{
MockCanvas mockCanvas(store);
mockCanvas.translate(-22.0f, -16.0f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]);
}
{
MockCanvas mockCanvas(store);
mockCanvas.translate(-16.0f, -22.0f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]);
}
@ -168,14 +168,14 @@ DEF_TEST(TileGrid_OverlapOffsetQueryAlignment, reporter) {
// The offset should cancel the top and left borders of the top left tile
// So a look-up at interval 0-10 should be grid aligned,
MockCanvas mockCanvas(tileBitmap);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
}
{
// Encroaching border by one pixel
MockCanvas mockCanvas(moreThanATileBitmap);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 2 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[1]);
@ -186,14 +186,14 @@ DEF_TEST(TileGrid_OverlapOffsetQueryAlignment, reporter) {
// with middle tile.
MockCanvas mockCanvas(tileBitmap);
mockCanvas.translate(SkIntToScalar(-8), SkIntToScalar(-8));
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]);
}
{
MockCanvas mockCanvas(tileBitmap);
mockCanvas.translate(-7.9f, -7.9f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 2 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[1]);
@ -201,7 +201,7 @@ DEF_TEST(TileGrid_OverlapOffsetQueryAlignment, reporter) {
{
MockCanvas mockCanvas(tileBitmap);
mockCanvas.translate(-8.1f, -8.1f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
REPORTER_ASSERT(reporter, 2 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]);
REPORTER_ASSERT(reporter, rect3 == mockCanvas.fRects[1]);
@ -212,7 +212,7 @@ DEF_TEST(TileGrid_OverlapOffsetQueryAlignment, reporter) {
// adjusted region, sitting right on top of the tile boundary.
MockCanvas mockCanvas(tinyBitmap);
mockCanvas.translate(-8.0f, -8.0f);
picture->draw(&mockCanvas);
picture->playback(&mockCanvas);
// This test passes by not asserting. We do not validate the rects recorded
// because the result is numerically unstable (floating point equality).
// The content of any one of the four tiles of the tilegrid would be a valid

Просмотреть файл

@ -220,7 +220,7 @@ void PictureRenderer::buildBBoxHierarchy() {
fPicture->cullRect().height(),
factory.get(),
this->recordFlags());
fPicture->draw(canvas);
fPicture->playback(canvas);
fPicture.reset(recorder.endRecording());
}
}
@ -361,7 +361,7 @@ bool RecordPictureRenderer::render(SkBitmap** out) {
factory.get(),
this->recordFlags());
this->scaleToScaleFactor(canvas);
fPicture->draw(canvas);
fPicture->playback(canvas);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
if (!fWritePath.isEmpty()) {
// Record the new picture as a new SKP with PNG encoded bitmaps.

Просмотреть файл

@ -201,9 +201,9 @@ static bool run_single_benchmark(const SkString& inputPath,
// Because the GPU preprocessing step relies on the in-memory picture
// statistics we need to rerecord the picture here
SkPictureRecorder recorder;
picture->draw(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
NULL, 0));
picture->playback(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
NULL, 0));
picture.reset(recorder.endRecording());
}

Просмотреть файл

@ -44,12 +44,12 @@ static SkPicture* rerecord(const SkPicture& src, bool skr) {
SkTileGridFactory factory(info);
SkPictureRecorder recorder;
src.draw(skr ? recorder.EXPERIMENTAL_beginRecording(src.cullRect().width(),
src.cullRect().height(),
&factory)
: recorder. DEPRECATED_beginRecording(src.cullRect().width(),
src.cullRect().height(),
&factory));
src.playback(skr ? recorder.EXPERIMENTAL_beginRecording(src.cullRect().width(),
src.cullRect().height(),
&factory)
: recorder. DEPRECATED_beginRecording(src.cullRect().width(),
src.cullRect().height(),
&factory));
return recorder.endRecording();
}
@ -64,7 +64,7 @@ static void bench(SkPMColor* scratch, const SkPicture& src, const char* name) {
canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLAGS_tile)));
// Draw once to warm any caches. The first sample otherwise can be very noisy.
picture->draw(canvas.get());
picture->playback(canvas.get());
WallTimer timer;
const double scale = timescale();
@ -73,7 +73,7 @@ static void bench(SkPMColor* scratch, const SkPicture& src, const char* name) {
// We assume timer overhead (typically, ~30ns) is insignificant
// compared to draw runtime (at least ~100us, usually several ms).
timer.start();
picture->draw(canvas.get());
picture->playback(canvas.get());
timer.end();
samples[i] = timer.fWall * scale;
}

Просмотреть файл

@ -61,11 +61,11 @@ static SkBBHFactory* parse_FLAGS_bbh() {
static void rerecord(const SkPicture& src, SkBBHFactory* bbhFactory) {
SkPictureRecorder recorder;
if (FLAGS_skr) {
src.draw(recorder.EXPERIMENTAL_beginRecording(src.cullRect().width(),
src.playback(recorder.EXPERIMENTAL_beginRecording(src.cullRect().width(),
src.cullRect().height(),
bbhFactory));
} else {
src.draw(recorder. DEPRECATED_beginRecording(src.cullRect().width(),
src.playback(recorder. DEPRECATED_beginRecording(src.cullRect().width(),
src.cullRect().height(),
bbhFactory));
}

Просмотреть файл

@ -62,7 +62,7 @@ int tool_main(int argc, char** argv) {
SkRecord record;
SkRecorder canvas(&record, w, h);
src->draw(&canvas);
src->playback(&canvas);
if (FLAGS_optimize) {
SkRecordOptimize(&record);

Просмотреть файл

@ -679,7 +679,7 @@ static int filter_picture(const SkString& inFile, const SkString& outFile) {
SkDebugCanvas debugCanvas(SkScalarCeilToInt(inPicture->cullRect().width()),
SkScalarCeilToInt(inPicture->cullRect().height()));
inPicture->draw(&debugCanvas);
inPicture->playback(&debugCanvas);
// delete the initial save and restore since replaying the commands will
// re-add them

Просмотреть файл

@ -55,9 +55,9 @@ int tool_main(int argc, char** argv) {
// The SkPicture tracking information is only generated during recording
// an isn't serialized. Replay the picture to regenerated the tracking data.
SkPictureRecorder recorder;
picture->draw(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
NULL, 0));
picture->playback(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
NULL, 0));
SkAutoTUnref<SkPicture> recorded(recorder.endRecording());
if (recorded->suitableForGpuRasterization(NULL)) {

Просмотреть файл

@ -184,17 +184,17 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w
// Because the GPU preprocessing step relies on the in-memory picture
// statistics we need to rerecord the picture here
SkPictureRecorder recorder;
picture->draw(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
NULL, 0));
picture->playback(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
NULL, 0));
picture.reset(recorder.endRecording());
}
while (FLAGS_bench_record) {
SkPictureRecorder recorder;
picture->draw(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
NULL, 0));
picture->playback(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
NULL, 0));
SkAutoTUnref<SkPicture> other(recorder.endRecording());
}