diff options
author | mtklein <mtklein@chromium.org> | 2014-06-27 12:34:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-27 12:34:44 -0700 |
commit | d3e474e20c6f0f24ddb6b2643e92975d60190daa (patch) | |
tree | f2e39eab8d338bc80f524904de5ab15bd4e0df5e | |
parent | 67ec1f8eecfb48bc0a6ba04c0057f103c1c9696f (diff) |
Deprecate SkPicture::clone().
Chrome will need -DSK_SUPPORT_LEGACY_PICTURE_CLONE.
This removes the modes from our tools that use clone(). No
bots run these. DM used clone() in a way that we can just
share the picture now.
I plan to bring back the ability to test multithreaded
picture rendering soon.
BUG=skia:2378
R=robertphillips@google.com, mtklein@google.com, bsalomon@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/338633011
-rw-r--r-- | dm/DM.cpp | 4 | ||||
-rw-r--r-- | dm/DMPDFTask.cpp | 2 | ||||
-rw-r--r-- | dm/DMPDFTask.h | 4 | ||||
-rw-r--r-- | gyp/skia_for_chromium_defines.gypi | 1 | ||||
-rw-r--r-- | gyp/utils.gypi | 2 | ||||
-rw-r--r-- | include/core/SkPicture.h | 2 | ||||
-rw-r--r-- | include/utils/SkCountdown.h | 36 | ||||
-rw-r--r-- | src/core/SkPicture.cpp | 2 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 27 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.h | 6 | ||||
-rw-r--r-- | src/utils/SkCountdown.cpp | 32 | ||||
-rw-r--r-- | tests/PictureTest.cpp | 23 | ||||
-rw-r--r-- | tools/PictureRenderer.cpp | 205 | ||||
-rw-r--r-- | tools/PictureRenderer.h | 38 | ||||
-rw-r--r-- | tools/PictureRenderingFlags.cpp | 45 | ||||
-rw-r--r-- | tools/bench_pictures_main.cpp | 5 | ||||
-rw-r--r-- | tools/render_pictures_main.cpp | 12 |
17 files changed, 43 insertions, 403 deletions
@@ -186,8 +186,8 @@ static void kick_off_skps(DM::Reporter* reporter, DM::TaskRunner* tasks) { exit(1); } - tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic->clone(), filename))); - tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic->clone(), filename, + tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic, filename))); + tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic, filename, RASTERIZE_PDF_PROC))); } } diff --git a/dm/DMPDFTask.cpp b/dm/DMPDFTask.cpp index ecca1300c8..5fee403a5b 100644 --- a/dm/DMPDFTask.cpp +++ b/dm/DMPDFTask.cpp @@ -32,7 +32,7 @@ PDFTask::PDFTask(const char* config, PDFTask::PDFTask(Reporter* reporter, TaskRunner* taskRunner, - SkPicture* picture, + const SkPicture* picture, SkString filename, RasterizePdfProc rasterizePdfProc) : CpuTask(reporter, taskRunner) diff --git a/dm/DMPDFTask.h b/dm/DMPDFTask.h index d107611732..ae0dcce4e0 100644 --- a/dm/DMPDFTask.h +++ b/dm/DMPDFTask.h @@ -24,7 +24,7 @@ public: PDFTask(Reporter*, TaskRunner*, - SkPicture*, + const SkPicture*, SkString name, RasterizePdfProc); @@ -37,7 +37,7 @@ public: private: // One of these two will be set. SkAutoTDelete<skiagm::GM> fGM; - SkAutoTUnref<SkPicture> fPicture; + SkAutoTUnref<const SkPicture> fPicture; const SkString fName; RasterizePdfProc fRasterize; diff --git a/gyp/skia_for_chromium_defines.gypi b/gyp/skia_for_chromium_defines.gypi index 19916e9839..9d0e96383e 100644 --- a/gyp/skia_for_chromium_defines.gypi +++ b/gyp/skia_for_chromium_defines.gypi @@ -13,6 +13,7 @@ # If these become 'permanent', they should be moved into skia_common.gypi # 'skia_for_chromium_defines': [ + 'SK_SUPPORT_LEGACY_PICTURE_CLONE', 'SK_SUPPORT_LEGACY_GETTOPDEVICE', 'SK_SUPPORT_LEGACY_BITMAP_CONFIG', 'SK_SUPPORT_LEGACY_N32_NAME', diff --git a/gyp/utils.gypi b/gyp/utils.gypi index 5fce7c7a80..52cc1547bc 100644 --- a/gyp/utils.gypi +++ b/gyp/utils.gypi @@ -9,11 +9,9 @@ 'sources': [ # Classes for a threadpool. '<(skia_include_path)/utils/SkCondVar.h', - '<(skia_include_path)/utils/SkCountdown.h', '<(skia_include_path)/utils/SkRunnable.h', '<(skia_include_path)/utils/SkThreadPool.h', '<(skia_src_path)/utils/SkCondVar.cpp', - '<(skia_src_path)/utils/SkCountdown.cpp', '<(skia_include_path)/utils/SkBoundaryPatch.h', '<(skia_include_path)/utils/SkFrontBufferedStream.h', diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index a53617fbc0..1f1378c415 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -110,6 +110,7 @@ public: virtual ~SkPicture(); +#ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE /** * Creates a thread-safe clone of the picture that is ready for playback. */ @@ -121,6 +122,7 @@ public: * SkPictures. */ void clone(SkPicture* pictures, int count) const; +#endif /** Replays the drawing commands on the specified canvas. @param canvas the canvas receiving the drawing commands. diff --git a/include/utils/SkCountdown.h b/include/utils/SkCountdown.h deleted file mode 100644 index 6bcec7d5ff..0000000000 --- a/include/utils/SkCountdown.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCountdown_DEFINED -#define SkCountdown_DEFINED - -#include "SkCondVar.h" -#include "SkRunnable.h" -#include "SkTypes.h" - -class SkCountdown : public SkRunnable { -public: - explicit SkCountdown(int32_t count); - - /** - * Resets the countdown to the count provided. - */ - void reset(int32_t count); - - virtual void run() SK_OVERRIDE; - - /** - * Blocks until run() has been called count times. - */ - void wait(); - -private: - SkCondVar fReady; - int32_t fCount; -}; - -#endif diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index 75160b8be4..45a0d2c38c 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -185,6 +185,7 @@ SkPicture::SkPicture(const SkPicture& src) : INHERITED() { // fRecord OK SkPicture::~SkPicture() {} +#ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE // fRecord TODO, fix by deleting this method SkPicture* SkPicture::clone() const { SkPicture* clonedPicture = SkNEW(SkPicture); @@ -256,6 +257,7 @@ void SkPicture::clone(SkPicture* pictures, int count) const { } } } +#endif//SK_SUPPORT_LEGACY_PICTURE_CLONE // fRecord OK void SkPicture::EXPERIMENTAL_addAccelData(const SkPicture::AccelData* data) const { diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index c3f24b95e1..148237a5a8 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -168,6 +168,7 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, #endif } +#ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE SkPicturePlayback::SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo) : fInfo(src.fInfo) { this->init(); @@ -223,6 +224,32 @@ SkPicturePlayback::SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInf } } } +#else +SkPicturePlayback::SkPicturePlayback(const SkPicturePlayback& src) : fInfo(src.fInfo) { + this->init(); + + fBitmapHeap.reset(SkSafeRef(src.fBitmapHeap.get())); + fPathHeap.reset(SkSafeRef(src.fPathHeap.get())); + + fOpData = SkSafeRef(src.fOpData); + + fBoundingHierarchy = src.fBoundingHierarchy; + fStateTree = src.fStateTree; + fContentInfo.set(src.fContentInfo); + + SkSafeRef(fBoundingHierarchy); + SkSafeRef(fStateTree); + + fBitmaps = SkSafeRef(src.fBitmaps); + fPaints = SkSafeRef(src.fPaints); + + fPictureCount = src.fPictureCount; + fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount); + for (int i = 0; i < fPictureCount; i++) { + fPictureRefs[i] = SkRef(src.fPictureRefs[i]); + } +} +#endif//SK_SUPPORT_LEGACY_PICTURE_CLONE void SkPicturePlayback::init() { fBitmaps = NULL; diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index 87380a6aaf..b929a735b4 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -119,6 +119,7 @@ private: int fNumAAHairlineConcavePaths; }; +#ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE /** * Container for data that is needed to deep copy a SkPicture. The container * enables the data to be generated once and reused for subsequent copies. @@ -130,11 +131,16 @@ struct SkPictCopyInfo { SkChunkFlatController controller; SkTDArray<SkFlatData*> paintData; }; +#endif class SkPicturePlayback { public: +#ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo = NULL); +#else + SkPicturePlayback(const SkPicturePlayback& src); +#endif SkPicturePlayback(const SkPictureRecord& record, const SkPictInfo&, bool deepCopyOps); static SkPicturePlayback* CreateFromStream(SkStream*, const SkPictInfo&, diff --git a/src/utils/SkCountdown.cpp b/src/utils/SkCountdown.cpp deleted file mode 100644 index 98b3545071..0000000000 --- a/src/utils/SkCountdown.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkCountdown.h" -#include "SkThread.h" - -SkCountdown::SkCountdown(int32_t count) -: fCount(count) {} - -void SkCountdown::reset(int32_t count) { - fCount = count; -} - -void SkCountdown::run() { - if (sk_atomic_dec(&fCount) == 1) { - fReady.lock(); - fReady.signal(); - fReady.unlock(); - } -} - -void SkCountdown::wait() { - fReady.lock(); - while (fCount > 0) { - fReady.wait(); - } - fReady.unlock(); -} diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index 6ec1e0a022..e62a68ba9a 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -1274,19 +1274,6 @@ static void test_bitmap_with_encoded_data(skiatest::Reporter* reporter) { SkSetErrorCallback(NULL, NULL); } -static void test_clone_empty(skiatest::Reporter* reporter) { - // This is a regression test for crbug.com/172062 - // 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. - { - SkPictureRecorder recorder; - recorder.beginRecording(1, 1); - SkAutoTUnref<SkPicture> picture(recorder.endRecording()); - SkAutoTUnref<SkPicture> destPicture(picture->clone()); - REPORTER_ASSERT(reporter, NULL != destPicture); - } -} - static void test_draw_empty(skiatest::Reporter* reporter) { SkBitmap result; make_bm(&result, 2, 2, SK_ColorBLACK, false); @@ -1556,15 +1543,6 @@ static void test_gen_id(skiatest::Reporter* reporter) { SkPicture emptyCopy(empty); REPORTER_ASSERT(reporter, empty.uniqueID() != emptyCopy.uniqueID()); - - // test out clone - { - SkAutoTUnref<SkPicture> cloneWithData(hasData->clone()); - REPORTER_ASSERT(reporter, hasData->uniqueID() == cloneWithData->uniqueID()); - - SkAutoTUnref<SkPicture> emptyClone(empty.clone()); - REPORTER_ASSERT(reporter, empty.uniqueID() != emptyClone->uniqueID()); - } } DEF_TEST(Picture, reporter) { @@ -1582,7 +1560,6 @@ DEF_TEST(Picture, reporter) { test_gatherpixelrefs(reporter); test_gatherpixelrefsandrects(reporter); test_bitmap_with_encoded_data(reporter); - test_clone_empty(reporter); test_draw_empty(reporter); test_clip_bound_opt(reporter); test_clip_expansion(reporter); diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp index d337a5ebb7..acc7878230 100644 --- a/tools/PictureRenderer.cpp +++ b/tools/PictureRenderer.cpp @@ -698,188 +698,6 @@ SkString TiledPictureRenderer::getConfigNameInternal() { /////////////////////////////////////////////////////////////////////////////////////////////// -// Holds all of the information needed to draw a set of tiles. -class CloneData : public SkRunnable { - -public: - CloneData(SkPicture* clone, SkCanvas* canvas, SkTDArray<SkRect>& rects, int start, int end, - SkRunnable* done, ImageResultsAndExpectations* jsonSummaryPtr, - bool useChecksumBasedFilenames, bool enableWrites) - : fClone(clone) - , fCanvas(canvas) - , fEnableWrites(enableWrites) - , fRects(rects) - , fStart(start) - , fEnd(end) - , fSuccess(NULL) - , fDone(done) - , fJsonSummaryPtr(jsonSummaryPtr) - , fUseChecksumBasedFilenames(useChecksumBasedFilenames) { - SkASSERT(fDone != NULL); - } - - virtual void run() SK_OVERRIDE { - SkGraphics::SetTLSFontCacheLimit(1024 * 1024); - - SkBitmap bitmap; - if (fBitmap != NULL) { - // All tiles are the same size. - setup_bitmap(&bitmap, SkScalarFloorToInt(fRects[0].width()), SkScalarFloorToInt(fRects[0].height())); - } - - for (int i = fStart; i < fEnd; i++) { - draw_tile_to_canvas(fCanvas, fRects[i], fClone); - if (fEnableWrites) { - if (!write(fCanvas, fWritePath, fMismatchPath, fInputFilename, fJsonSummaryPtr, - fUseChecksumBasedFilenames, &i) - && fSuccess != NULL) { - *fSuccess = false; - // If one tile fails to write to a file, do not continue drawing the rest. - break; - } - if (fBitmap != NULL) { - if (fCanvas->readPixels(&bitmap, 0, 0)) { - SkAutoLockPixels alp(*fBitmap); - bitmapCopyAtOffset(bitmap, fBitmap, SkScalarFloorToInt(fRects[i].left()), - SkScalarFloorToInt(fRects[i].top())); - } else { - *fSuccess = false; - // If one tile fails to read pixels, do not continue drawing the rest. - break; - } - } - } - } - fDone->run(); - } - - void setPathsAndSuccess(const SkString& writePath, const SkString& mismatchPath, - const SkString& inputFilename, bool* success) { - fWritePath.set(writePath); - fMismatchPath.set(mismatchPath); - fInputFilename.set(inputFilename); - fSuccess = success; - } - - void setBitmap(SkBitmap* bitmap) { - fBitmap = bitmap; - } - -private: - // All pointers unowned. - SkPicture* fClone; // Picture to draw from. Each CloneData has a unique one which - // is threadsafe. - SkCanvas* fCanvas; // Canvas to draw to. Reused for each tile. - bool fEnableWrites; // TODO(epoger): Temporary hack; see declaration of - // fEnableWrites in PictureRenderer.h. - SkString fWritePath; // If not empty, write all results into this directory. - SkString fMismatchPath; // If not empty, write all unexpected results into this dir. - SkString fInputFilename; // Filename of input SkPicture file. - SkTDArray<SkRect>& fRects; // All tiles of the picture. - const int fStart; // Range of tiles drawn by this thread. - const int fEnd; - bool* fSuccess; // Only meaningful if path is non-null. Shared by all threads, - // and only set to false upon failure to write to a PNG. - SkRunnable* fDone; - SkBitmap* fBitmap; - ImageResultsAndExpectations* fJsonSummaryPtr; - bool fUseChecksumBasedFilenames; -}; - -MultiCorePictureRenderer::MultiCorePictureRenderer(int threadCount) -: fNumThreads(threadCount) -, fThreadPool(threadCount) -, fCountdown(threadCount) { - // Only need to create fNumThreads - 1 clones, since one thread will use the base - // picture. - fPictureClones = SkNEW_ARRAY(SkPicture, fNumThreads - 1); - fCloneData = SkNEW_ARRAY(CloneData*, fNumThreads); -} - -void MultiCorePictureRenderer::init(SkPicture *pict, const SkString* writePath, - const SkString* mismatchPath, const SkString* inputFilename, - bool useChecksumBasedFilenames) { - // Set fPicture and the tiles. - this->INHERITED::init(pict, writePath, mismatchPath, inputFilename, useChecksumBasedFilenames); - for (int i = 0; i < fNumThreads; ++i) { - *fCanvasPool.append() = this->setupCanvas(this->getTileWidth(), this->getTileHeight()); - } - // Only need to create fNumThreads - 1 clones, since one thread will use the base picture. - fPicture->clone(fPictureClones, fNumThreads - 1); - // Populate each thread with the appropriate data. - // Group the tiles into nearly equal size chunks, rounding up so we're sure to cover them all. - const int chunkSize = (fTileRects.count() + fNumThreads - 1) / fNumThreads; - - for (int i = 0; i < fNumThreads; i++) { - SkPicture* pic; - if (i == fNumThreads-1) { - // The last set will use the original SkPicture. - pic = fPicture; - } else { - pic = &fPictureClones[i]; - } - const int start = i * chunkSize; - const int end = SkMin32(start + chunkSize, fTileRects.count()); - fCloneData[i] = SkNEW_ARGS(CloneData, - (pic, fCanvasPool[i], fTileRects, start, end, &fCountdown, - fJsonSummaryPtr, useChecksumBasedFilenames, fEnableWrites)); - } -} - -bool MultiCorePictureRenderer::render(SkBitmap** out) { - bool success = true; - if (!fWritePath.isEmpty() || !fMismatchPath.isEmpty()) { - for (int i = 0; i < fNumThreads-1; i++) { - fCloneData[i]->setPathsAndSuccess(fWritePath, fMismatchPath, fInputFilename, &success); - } - } - - if (NULL != out) { - *out = SkNEW(SkBitmap); - setup_bitmap(*out, fPicture->width(), fPicture->height()); - for (int i = 0; i < fNumThreads; i++) { - fCloneData[i]->setBitmap(*out); - } - } else { - for (int i = 0; i < fNumThreads; i++) { - fCloneData[i]->setBitmap(NULL); - } - } - - fCountdown.reset(fNumThreads); - for (int i = 0; i < fNumThreads; i++) { - fThreadPool.add(fCloneData[i]); - } - fCountdown.wait(); - - return success; -} - -void MultiCorePictureRenderer::end() { - for (int i = 0; i < fNumThreads - 1; i++) { - SkDELETE(fCloneData[i]); - fCloneData[i] = NULL; - } - - fCanvasPool.unrefAll(); - - this->INHERITED::end(); -} - -MultiCorePictureRenderer::~MultiCorePictureRenderer() { - // Each individual CloneData was deleted in end. - SkDELETE_ARRAY(fCloneData); - SkDELETE_ARRAY(fPictureClones); -} - -SkString MultiCorePictureRenderer::getConfigNameInternal() { - SkString name = this->INHERITED::getConfigNameInternal(); - name.appendf("_multi_%i_threads", fNumThreads); - return name; -} - -/////////////////////////////////////////////////////////////////////////////////////////////// - void PlaybackCreationRenderer::setup() { SkAutoTDelete<SkBBHFactory> factory(this->getFactory()); fRecorder.reset(SkNEW(SkPictureRecorder)); @@ -941,27 +759,4 @@ PictureRenderer* CreateGatherPixelRefsRenderer() { return SkNEW(GatherRenderer); } -/////////////////////////////////////////////////////////////////////////////// - -class PictureCloneRenderer : public PictureRenderer { -public: - virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE { - for (int i = 0; i < 100; ++i) { - SkPicture* clone = fPicture->clone(); - SkSafeUnref(clone); - } - - return (fWritePath.isEmpty()); // we don't have anything to write - } - -private: - virtual SkString getConfigNameInternal() SK_OVERRIDE { - return SkString("picture_clone"); - } -}; - -PictureRenderer* CreatePictureCloneRenderer() { - return SkNEW(PictureCloneRenderer); -} - } // namespace sk_tools diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h index e6f4020dfd..13b60ecb09 100644 --- a/tools/PictureRenderer.h +++ b/tools/PictureRenderer.h @@ -9,7 +9,6 @@ #define PictureRenderer_DEFINED #include "SkCanvas.h" -#include "SkCountdown.h" #include "SkDrawFilter.h" #include "SkJSONCPP.h" #include "SkMath.h" @@ -18,10 +17,8 @@ #include "SkPictureRecorder.h" #include "SkRect.h" #include "SkRefCnt.h" -#include "SkRunnable.h" #include "SkString.h" #include "SkTDArray.h" -#include "SkThreadPool.h" #include "SkTypes.h" #if SK_SUPPORT_GPU @@ -543,7 +540,6 @@ public: * Renders to tiles, rather than a single canvas. * If fWritePath was provided, a separate file is * created for each tile, named "path0.png", "path1.png", etc. - * Multithreaded mode currently does not support writing to a file. */ virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; @@ -653,39 +649,6 @@ private: typedef PictureRenderer INHERITED; }; -class CloneData; - -class MultiCorePictureRenderer : public TiledPictureRenderer { -public: - explicit MultiCorePictureRenderer(int threadCount); - - ~MultiCorePictureRenderer(); - - virtual void init(SkPicture* pict, const SkString* writePath, const SkString* mismatchPath, - const SkString* inputFilename, bool useChecksumBasedFilenames) SK_OVERRIDE; - - /** - * Behaves like TiledPictureRenderer::render(), only using multiple threads. - */ - virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; - - virtual void end() SK_OVERRIDE; - - virtual bool supportsTimingIndividualTiles() SK_OVERRIDE { return false; } - -private: - virtual SkString getConfigNameInternal() SK_OVERRIDE; - - const int fNumThreads; - SkTDArray<SkCanvas*> fCanvasPool; - SkThreadPool fThreadPool; - SkPicture* fPictureClones; - CloneData** fCloneData; - SkCountdown fCountdown; - - typedef TiledPictureRenderer INHERITED; -}; - /** * This class does not do any rendering, but its render function executes turning an SkPictureRecord * into an SkPicturePlayback, which we want to time. @@ -709,7 +672,6 @@ private: }; extern PictureRenderer* CreateGatherPixelRefsRenderer(); -extern PictureRenderer* CreatePictureCloneRenderer(); } diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp index 5acec267b0..3e7821819f 100644 --- a/tools/PictureRenderingFlags.cpp +++ b/tools/PictureRenderingFlags.cpp @@ -66,8 +66,6 @@ DEFINE_string(mode, "simple", "Run in the corresponding mode:\n" "\tSkPicturePlayback.\n" "rerecord: (Only in render_pictures) Record the picture as a new skp,\n" "\twith the bitmaps PNG encoded.\n"); -DEFINE_int32(multi, 1, "Set the number of threads for multi threaded drawing. " - "If > 1, requires tiled rendering."); DEFINE_bool(pipe, false, "Use SkGPipe rendering. Currently incompatible with \"mode\"."); DEFINE_string2(readPath, r, "", "skp files or directories of skp files to process."); DEFINE_double(scale, 1, "Set the scale factor."); @@ -78,11 +76,6 @@ DEFINE_string(viewport, "", "width height: Set the viewport."); sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { error.reset(); - if (FLAGS_multi <= 0) { - error.printf("--multi must be > 0, was %i", FLAGS_multi); - return NULL; - } - bool useTiles = false; const char* widthString = NULL; const char* heightString = NULL; @@ -97,9 +90,6 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { if (0 == strcmp(mode, "record")) { renderer.reset(SkNEW(sk_tools::RecordPictureRenderer)); gridSupported = true; - // undocumented - } else if (0 == strcmp(mode, "clone")) { - renderer.reset(sk_tools::CreatePictureCloneRenderer()); } else if (0 == strcmp(mode, "tile") || 0 == strcmp(mode, "pow2tile") || 0 == strcmp(mode, "copyTile")) { useTiles = true; @@ -170,9 +160,6 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { x = y = 4; } tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (x, y))); - } else if (FLAGS_multi > 1) { - tiledRenderer.reset(SkNEW_ARGS(sk_tools::MultiCorePictureRenderer, - (FLAGS_multi))); } else { tiledRenderer.reset(SkNEW(sk_tools::TiledPictureRenderer)); } @@ -230,10 +217,6 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { } } else { // useTiles - if (FLAGS_multi > 1) { - error.printf("Multithreaded drawing requires tiled rendering.\n"); - return NULL; - } if (FLAGS_pipe) { if (renderer != NULL) { error.printf("Pipe is incompatible with other modes.\n"); @@ -270,59 +253,31 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { #if SK_SUPPORT_GPU else if (0 == strcmp(FLAGS_config[0], "gpu")) { deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; - if (FLAGS_multi > 1) { - error.printf("GPU not compatible with multithreaded tiling.\n"); - return NULL; - } } else if (0 == strcmp(FLAGS_config[0], "msaa4")) { deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; - if (FLAGS_multi > 1) { - error.printf("GPU not compatible with multithreaded tiling.\n"); - return NULL; - } sampleCount = 4; } else if (0 == strcmp(FLAGS_config[0], "msaa16")) { deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; - if (FLAGS_multi > 1) { - error.printf("GPU not compatible with multithreaded tiling.\n"); - return NULL; - } sampleCount = 16; } else if (0 == strcmp(FLAGS_config[0], "nvprmsaa4")) { deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; - if (FLAGS_multi > 1) { - error.printf("GPU not compatible with multithreaded tiling.\n"); - return NULL; - } sampleCount = 4; } else if (0 == strcmp(FLAGS_config[0], "nvprmsaa16")) { deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; - if (FLAGS_multi > 1) { - error.printf("GPU not compatible with multithreaded tiling.\n"); - return NULL; - } sampleCount = 16; } #if SK_ANGLE else if (0 == strcmp(FLAGS_config[0], "angle")) { deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; - if (FLAGS_multi > 1) { - error.printf("Angle not compatible with multithreaded tiling.\n"); - return NULL; - } } #endif #if SK_MESA else if (0 == strcmp(FLAGS_config[0], "mesa")) { deviceType = sk_tools::PictureRenderer::kMesa_DeviceType; - if (FLAGS_multi > 1) { - error.printf("Mesa not compatible with multithreaded tiling.\n"); - return NULL; - } } #endif #endif diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp index 6073fe9f73..f6cd8e9bd7 100644 --- a/tools/bench_pictures_main.cpp +++ b/tools/bench_pictures_main.cpp @@ -42,7 +42,6 @@ DEFINE_string(logFile, "", "Destination for writing log output, in addition to s DEFINE_bool(logPerIter, false, "Log each repeat timer instead of mean."); DEFINE_string(jsonLog, "", "Destination for writing JSON data."); DEFINE_bool(min, false, "Print the minimum times (instead of average)."); -DECLARE_int32(multi); DECLARE_string(readPath); DEFINE_int32(repeat, 1, "Set the number of times to repeat each test."); DEFINE_bool(timeIndividualTiles, false, "Report times for drawing individual tiles, rather than " @@ -336,10 +335,6 @@ static void setup_benchmark(sk_tools::PictureBenchmark* benchmark) { } if (FLAGS_timeIndividualTiles) { - if (FLAGS_multi > 1) { - gLogger.logError("Cannot time individual tiles with more than one thread.\n"); - exit(-1); - } sk_tools::TiledPictureRenderer* tiledRenderer = renderer->getTiledRenderer(); if (NULL == tiledRenderer) { gLogger.logError("--timeIndividualTiles requires tiled rendering.\n"); diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp index 850053cfc6..c2c7875b28 100644 --- a/tools/render_pictures_main.cpp +++ b/tools/render_pictures_main.cpp @@ -26,7 +26,6 @@ #include "picture_utils.h" // Flags used by this file, alphabetically: -DEFINE_int32(clone, 0, "Clone the picture n times before rendering."); DECLARE_bool(deferImageDecoding); DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Components that differ " "by more than this amount are considered errors, though all diffs are reported. " @@ -186,12 +185,6 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w SkAutoTUnref<SkPicture> other(recorder.endRecording()); } - for (int i = 0; i < FLAGS_clone; ++i) { - SkPicture* clone = picture->clone(); - SkDELETE(picture); - picture = clone; - } - SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(), inputPath.c_str()); @@ -424,11 +417,6 @@ int tool_main(int argc, char** argv) { exit(-1); } - if (FLAGS_clone < 0) { - SkDebugf("--clone must be >= 0. Was %i\n", FLAGS_clone); - exit(-1); - } - if (FLAGS_writeEncodedImages) { if (FLAGS_writePath.isEmpty()) { SkDebugf("--writeEncodedImages requires --writePath\n"); |