aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-09-04 08:42:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-04 08:42:50 -0700
commitc5ba71d2e5cd426def66fa49dcf003e5b2c98dc7 (patch)
tree120359b17c8143f85462fefd855d2d94b50ce785
parent227c54e3d4e7b738d0b11a2f68b63cb1fd79cb12 (diff)
Change SkPicture::draw to playback
R=reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/540963002
-rw-r--r--bench/PicturePlaybackBench.cpp2
-rw-r--r--bench/SKPBench.cpp2
-rw-r--r--bench/nanobench.cpp6
-rw-r--r--debugger/SkDebugger.cpp2
-rw-r--r--dm/DMPDFTask.cpp2
-rw-r--r--dm/DMQuiltTask.cpp4
-rw-r--r--experimental/nanomsg/picture_demo.cpp2
-rw-r--r--gm/distantclip.cpp8
-rw-r--r--gm/gmmain.cpp2
-rw-r--r--gm/optimizations.cpp8
-rw-r--r--gyp/skia_for_android_framework_defines.gypi1
-rw-r--r--gyp/skia_for_chromium_defines.gypi1
-rw-r--r--include/core/SkPicture.h14
-rw-r--r--samplecode/SampleAll.cpp2
-rw-r--r--samplecode/SampleApp.cpp2
-rw-r--r--samplecode/SamplePictFile.cpp12
-rw-r--r--src/core/SkCanvas.cpp2
-rw-r--r--src/core/SkPicture.cpp4
-rw-r--r--src/core/SkPictureRecorder.cpp2
-rwxr-xr-xtests/PathOpsSkpClipTest.cpp4
-rw-r--r--tests/PictureTest.cpp10
-rw-r--r--tests/SerializationTest.cpp2
-rw-r--r--tests/TileGridTest.cpp28
-rw-r--r--tools/PictureRenderer.cpp4
-rw-r--r--tools/bench_pictures_main.cpp6
-rw-r--r--tools/bench_playback.cpp16
-rw-r--r--tools/bench_record.cpp4
-rw-r--r--tools/dump_record.cpp2
-rw-r--r--tools/filtermain.cpp2
-rw-r--r--tools/gpuveto.cpp6
-rw-r--r--tools/render_pictures_main.cpp12
31 files changed, 93 insertions, 81 deletions
diff --git a/bench/PicturePlaybackBench.cpp b/bench/PicturePlaybackBench.cpp
index 0109c720fc..947a7844f6 100644
--- a/bench/PicturePlaybackBench.cpp
+++ b/bench/PicturePlaybackBench.cpp
@@ -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);
}
}
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index cd7d4b00e1..308cea6dd0 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -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();
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index a484fc2b40..ea62570ea0 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -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());
}
diff --git a/debugger/SkDebugger.cpp b/debugger/SkDebugger.cpp
index fda8f9ade9..8833df3e7b 100644
--- a/debugger/SkDebugger.cpp
+++ b/debugger/SkDebugger.cpp
@@ -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;
}
diff --git a/dm/DMPDFTask.cpp b/dm/DMPDFTask.cpp
index 7d1fa5924d..c047771587 100644
--- a/dm/DMPDFTask.cpp
+++ b/dm/DMPDFTask.cpp
@@ -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());
}
diff --git a/dm/DMQuiltTask.cpp b/dm/DMQuiltTask.cpp
index a824de0f15..6ffe360ea8 100644
--- a/dm/DMQuiltTask.cpp
+++ b/dm/DMQuiltTask.cpp
@@ -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.
diff --git a/experimental/nanomsg/picture_demo.cpp b/experimental/nanomsg/picture_demo.cpp
index f04a96e956..5efa03c72c 100644
--- a/experimental/nanomsg/picture_demo.cpp
+++ b/experimental/nanomsg/picture_demo.cpp
@@ -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");
diff --git a/gm/distantclip.cpp b/gm/distantclip.cpp
index 0f8955948a..54938b0d13 100644
--- a/gm/distantclip.cpp
+++ b/gm/distantclip.cpp
@@ -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
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 5d6481c34d..40d616e9f4 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -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,
diff --git a/gm/optimizations.cpp b/gm/optimizations.cpp
index 00be04cee6..85ce3e9d94 100644
--- a/gm/optimizations.cpp
+++ b/gm/optimizations.cpp
@@ -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();
diff --git a/gyp/skia_for_android_framework_defines.gypi b/gyp/skia_for_android_framework_defines.gypi
index c5fd7693ba..ec0725f57e 100644
--- a/gyp/skia_for_android_framework_defines.gypi
+++ b/gyp/skia_for_android_framework_defines.gypi
@@ -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',
],
},
}
diff --git a/gyp/skia_for_chromium_defines.gypi b/gyp/skia_for_chromium_defines.gypi
index 225eb5b500..f614cd324b 100644
--- a/gyp/skia_for_chromium_defines.gypi
+++ b/gyp/skia_for_chromium_defines.gypi
@@ -20,6 +20,7 @@
'SK_IGNORE_GPU_DITHER',
'SK_SUPPORT_LEGACY_IMAGECACHE_NAME',
'SK_LEGACY_PICTURE_SIZE_API',
+ 'SK_LEGACY_PICTURE_DRAW_API',
],
},
}
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 7f0665e046..d8aced19ab 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -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); }
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 395314c7ff..19e692f518 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -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);
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index e8d6d9911e..9c9b34384c 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1376,7 +1376,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
orig->drawPicture(pict.get());
}
} else {
- picture->draw(orig);
+ picture->playback(orig);
}
}
diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp
index 3d7acfc47d..df0c369736 100644
--- a/samplecode/SamplePictFile.cpp
+++ b/samplecode/SamplePictFile.cpp
@@ -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();
}
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 83fe1407d5..3d2fc8c498 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -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);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index c0fc371054..e80a17bd22 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -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*/));
}
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index fadb937110..92deac36d2 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -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);
}
}
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
index 0769141685..b8142cd654 100755
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -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();
}
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 8b19df2161..eb85c94a69 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -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);
}
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index ea03e875a2..b5582dccfc 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -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;
}
diff --git a/tests/TileGridTest.cpp b/tests/TileGridTest.cpp
index 81f383d97e..16434abdc6 100644
--- a/tests/TileGridTest.cpp
+++ b/tests/TileGridTest.cpp
@@ -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
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index ed5bdfe612..b2bac003f4 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -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.
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index 4bb31949c9..2eda73c40f 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -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());
}
diff --git a/tools/bench_playback.cpp b/tools/bench_playback.cpp
index f5bbc12c0a..53c988cd66 100644
--- a/tools/bench_playback.cpp
+++ b/tools/bench_playback.cpp
@@ -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;
}
diff --git a/tools/bench_record.cpp b/tools/bench_record.cpp
index 45a143f824..fe28e342a4 100644
--- a/tools/bench_record.cpp
+++ b/tools/bench_record.cpp
@@ -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));
}
diff --git a/tools/dump_record.cpp b/tools/dump_record.cpp
index bc1538fdf1..fc2e102623 100644
--- a/tools/dump_record.cpp
+++ b/tools/dump_record.cpp
@@ -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);
diff --git a/tools/filtermain.cpp b/tools/filtermain.cpp
index a7ed20d928..00854d4e3e 100644
--- a/tools/filtermain.cpp
+++ b/tools/filtermain.cpp
@@ -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
diff --git a/tools/gpuveto.cpp b/tools/gpuveto.cpp
index bfe3837626..4e9fdebd4b 100644
--- a/tools/gpuveto.cpp
+++ b/tools/gpuveto.cpp
@@ -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)) {
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index c9bdf13451..9ec136c1e7 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -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());
}