aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-31 17:55:12 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-31 17:55:12 +0000
commit8ddc26b68c4e41199c06961da3bff2ce72afff14 (patch)
treec955049c757cda33d6a99709159744fd0a054c2b /tools
parent37dab05d32d095247a01674f1a4bd940c3337369 (diff)
Actually identify required saveLayers in SkGpuDevice::EXPERIMENTAL_drawPicture
NOTRY=true R=bsalomon@google.com, rmistry@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/212933002 git-svn-id: http://skia.googlecode.com/svn/trunk@13993 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r--tools/PictureRenderer.cpp17
-rw-r--r--tools/PictureRenderer.h4
-rw-r--r--tools/render_pictures_main.cpp2
3 files changed, 12 insertions, 11 deletions
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 9cb43f73d4..2afd3745d1 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -495,11 +495,10 @@ void TiledPictureRenderer::init(SkPicture* pict, const SkString* outputDir,
// Do not call INHERITED::init(), which would create a (potentially large) canvas which is not
// used by bench_pictures.
- fPicture = pict;
+ fPicture = SkRef(pict);
this->CopyString(&fOutputDir, outputDir);
this->CopyString(&fInputFilename, inputFilename);
fUseChecksumBasedFilenames = useChecksumBasedFilenames;
- fPicture->ref();
this->buildBBoxHierarchy();
if (fTileWidthPercentage > 0) {
@@ -694,7 +693,7 @@ bool TiledPictureRenderer::render(SkBitmap** out) {
SkCanvas* TiledPictureRenderer::setupCanvas(int width, int height) {
SkCanvas* canvas = this->INHERITED::setupCanvas(width, height);
- SkASSERT(fPicture != NULL);
+ SkASSERT(NULL != fPicture);
// Clip the tile to an area that is completely inside both the SkPicture and the viewport. This
// is mostly important for tiles on the right and bottom edges as they may go over this area and
// the picture may have some commands that draw outside of this area and so should not actually
@@ -910,7 +909,7 @@ void PlaybackCreationRenderer::setup() {
SkCanvas* recorder = fReplayer->beginRecording(this->getViewWidth(), this->getViewHeight(),
this->recordFlags());
this->scaleToScaleFactor(recorder);
- fPicture->draw(recorder);
+ recorder->drawPicture(*fPicture);
}
bool PlaybackCreationRenderer::render(SkBitmap** out) {
@@ -945,12 +944,12 @@ SkPicture* PictureRenderer::createPicture() {
return SkNEW(SkPicture);
case kQuadTree_BBoxHierarchyType:
return SkNEW_ARGS(SkQuadTreePicture, (SkIRect::MakeWH(fPicture->width(),
- fPicture->height())));
+ fPicture->height())));
case kRTree_BBoxHierarchyType:
return SkNEW(RTreePicture);
case kTileGrid_BBoxHierarchyType:
return SkNEW_ARGS(SkTileGridPicture, (fPicture->width(),
- fPicture->height(), fGridInfo));
+ fPicture->height(), fGridInfo));
}
SkASSERT(0); // invalid bbhType
return NULL;
@@ -960,8 +959,7 @@ SkPicture* PictureRenderer::createPicture() {
class GatherRenderer : public PictureRenderer {
public:
- virtual bool render(SkBitmap** out = NULL)
- SK_OVERRIDE {
+ virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE {
SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->width()),
SkIntToScalar(fPicture->height()));
SkData* data = SkPictureUtils::GatherPixelRefs(fPicture, bounds);
@@ -984,8 +982,7 @@ PictureRenderer* CreateGatherPixelRefsRenderer() {
class PictureCloneRenderer : public PictureRenderer {
public:
- virtual bool render(SkBitmap** out = NULL)
- SK_OVERRIDE {
+ virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE {
for (int i = 0; i < 100; ++i) {
SkPicture* clone = fPicture->clone();
SkSafeUnref(clone);
diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h
index 8192cacc0d..7c5a9da1f0 100644
--- a/tools/PictureRenderer.h
+++ b/tools/PictureRenderer.h
@@ -365,6 +365,10 @@ public:
return fCanvas;
}
+ SkPicture* getPicture() {
+ return fPicture;
+ }
+
PictureRenderer()
: fPicture(NULL)
, fJsonSummaryPtr(NULL)
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 4e51bfa66e..7563074e5b 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -199,7 +199,7 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* o
if (FLAGS_preprocess) {
if (NULL != renderer.getCanvas()) {
- renderer.getCanvas()->EXPERIMENTAL_optimize(picture);
+ renderer.getCanvas()->EXPERIMENTAL_optimize(renderer.getPicture());
}
}