Retract SkPicture::kOptimizeForClippedPlayback_RecordingFlag from public API
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 16 Apr 2014 16:02:10 +0000 (16:02 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 16 Apr 2014 16:02:10 +0000 (16:02 +0000)
This CL sets the stage for retracting the SkPicture::kOptimizeForClippedPlayback_RecordingFlag flag
from the public API (more work needs to be done in Blink & Chrome). In the new world the only way
to set this flag (and thus instantiate an SkPicture-derived
class) is by passing a factory to the SkPictureRecorder class. This is to get all clients always using
factories so that we can then change the factory call used (i.e., so the factory just creates a BBH) and
do away with the SkPicture-derived classes.

BUG=skia:2315
R=reed@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/239703006

git-svn-id: http://skia.googlecode.com/svn/trunk@14221 2bbb7eff-a529-9590-31e7-b0007b416f81

16 files changed:
dm/DMReplayTask.cpp
gm/gmmain.cpp
gyp/core.gypi
gyp/skia_for_chromium_defines.gypi
include/core/SkPicture.h
include/core/SkRTreePicture.h [new file with mode: 0644]
include/core/SkTileGridPicture.h
samplecode/SamplePictFile.cpp
src/core/SkPicture.cpp
src/core/SkQuadTreePicture.h
src/core/SkRTreePicture.cpp [new file with mode: 0644]
tests/ImageFilterTest.cpp
tests/PictureTest.cpp
tests/TileGridTest.cpp
tools/PictureRenderer.cpp
tools/bench_record.cpp

index 2c23caec4b8596b8dc81cbc8785f863379a3a41f..736cd5cf1869c928963cd47a891b240bc8f3f25a 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "SkCommandLineFlags.h"
 #include "SkPicture.h"
+#include "SkRTreePicture.h"
 
 DEFINE_bool(replay, true, "If true, run picture replay tests.");
 DEFINE_bool(rtree,  true, "If true, run picture replay tests with an rtree.");
@@ -22,8 +23,11 @@ ReplayTask::ReplayTask(const Task& parent,
     {}
 
 void ReplayTask::draw() {
-    const uint32_t flags = fUseRTree ? SkPicture::kOptimizeForClippedPlayback_RecordingFlag : 0;
-    SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), flags));
+    SkAutoTUnref<SkPictureFactory> factory;
+    if (fUseRTree) {
+        factory.reset(SkNEW(SkRTreePictureFactory));
+    }
+    SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), 0, factory));
 
     SkBitmap bitmap;
     SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
index 4d5866a3d2c04f679001fe79381535f8d8323bb6..438c739c5e91f0139b3fc49f6010c1eb97179ce1 100644 (file)
@@ -34,7 +34,9 @@
 #include "SkOSFile.h"
 #include "SkPDFRasterizer.h"
 #include "SkPicture.h"
+#include "SkQuadTreePicture.h"
 #include "SkRefCnt.h"
+#include "SkRTreePicture.h"
 #include "SkScalar.h"
 #include "SkStream.h"
 #include "SkString.h"
@@ -139,6 +141,7 @@ enum BbhType {
     kNone_BbhType,
     kRTree_BbhType,
     kTileGrid_BbhType,
+    kQuadTree_BbhType
 };
 
 enum ConfigFlags {
@@ -1018,9 +1021,10 @@ public:
             info.fOffset.setZero();
             info.fTileInterval.set(16, 16);
             factory.reset(SkNEW_ARGS(SkTileGridPictureFactory, (info)));
-        }
-        if (kNone_BbhType != bbhType) {
-            recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
+        } else if (kQuadTree_BbhType == bbhType) {
+            factory.reset(SkNEW(SkQuadTreePictureFactory));
+        } else if (kRTree_BbhType == bbhType) {
+            factory.reset(SkNEW(SkRTreePictureFactory));
         }
         SkPictureRecorder recorder(factory);
         SkCanvas* cv = recorder.beginRecording(width, height, recordFlags);
@@ -1449,6 +1453,7 @@ DEFINE_string(mismatchPath, "", "Write images for tests that failed due to "
 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for which "
               "testIndex %% divisor == remainder.");
 DEFINE_bool(pipe, false, "Exercise the SkGPipe replay test pass.");
+DEFINE_bool(quadtree, false, "Exercise the QuadTree variant of SkPicture test pass.");
 DEFINE_string2(readPath, r, "", "Read reference images from this dir, and report "
                "any differences between those and the newly generated ones.");
 DEFINE_bool(replay, false, "Exercise the SkPicture replay test pass.");
@@ -1607,14 +1612,29 @@ ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
 
     if (FLAGS_rtree) {
         const char renderModeDescriptor[] = "-rtree";
-        if ((gmFlags & GM::kSkipPicture_Flag) ||
-            (gmFlags & GM::kSkipTiled_Flag)) {
+        if ((gmFlags & GM::kSkipPicture_Flag) || (gmFlags & GM::kSkipTiled_Flag)) {
+            gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNamePlusConfig,
+                                     renderModeDescriptor);
+            errorsForAllModes.add(kIntentionallySkipped_ErrorType);
+        } else {
+            SkPicture* pict = gmmain.generate_new_picture(gm, kRTree_BbhType, 0);
+            SkAutoUnref aur(pict);
+            SkBitmap bitmap;
+            gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
+            errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
+                gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap,
+                &comparisonBitmap));
+        }
+    }
+
+    if (FLAGS_quadtree) {
+        const char renderModeDescriptor[] = "-quadtree";
+        if ((gmFlags & GM::kSkipPicture_Flag) || (gmFlags & GM::kSkipTiled_Flag)) {
             gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNamePlusConfig,
                                      renderModeDescriptor);
             errorsForAllModes.add(kIntentionallySkipped_ErrorType);
         } else {
-            SkPicture* pict = gmmain.generate_new_picture(
-                gm, kRTree_BbhType, SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
+            SkPicture* pict = gmmain.generate_new_picture(gm, kQuadTree_BbhType, 0);
             SkAutoUnref aur(pict);
             SkBitmap bitmap;
             gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
index 3a8dc21485b58b9c5cf932b1e08879ba5e4a09ee..f1f88f8ec38547d918e30b020f6ec1eb9c8f9a95 100644 (file)
         '<(skia_src_path)/core/SkRRect.cpp',
         '<(skia_src_path)/core/SkRTree.h',
         '<(skia_src_path)/core/SkRTree.cpp',
+        '<(skia_src_path)/core/SkRTreePicture.cpp',
         '<(skia_src_path)/core/SkScaledImageCache.cpp',
         '<(skia_src_path)/core/SkScalar.cpp',
         '<(skia_src_path)/core/SkScalerContext.cpp',
         '<(skia_include_path)/core/SkRefCnt.h',
         '<(skia_include_path)/core/SkRegion.h',
         '<(skia_include_path)/core/SkRRect.h',
+        '<(skia_include_path)/core/SkRTreePicture.h',
         '<(skia_include_path)/core/SkScalar.h',
         '<(skia_include_path)/core/SkShader.h',
         '<(skia_include_path)/core/SkStream.h',
index c555214be11ef860f812eaa0220184ba10b167fc..4fe66711af688bab0b05d0393f60449d4c3cdcf6 100644 (file)
@@ -16,6 +16,7 @@
       'SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS=1',
       'SK_SUPPORT_LEGACY_GETTOPDEVICE',
       'SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD',
+      'SK_SUPPORT_DEPRECATED_RECORD_FLAGS',
       'SK_SUPPORT_LEGACY_N32_NAME',
     ],
   },
index 9690469d9f13ef1f6513df2d481fd7e1e2f8de5b..441833db36d6207e1357dafbce84586e6a416af1 100644 (file)
@@ -139,7 +139,16 @@ public:
             clip-query calls will reflect the path's bounds, not the actual
             path.
          */
-        kUsePathBoundsForClip_RecordingFlag = 0x01,
+        kUsePathBoundsForClip_RecordingFlag = 0x01
+    };
+
+#ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS
+    // TODO: once kOptimizeForClippedPlayback_RecordingFlag is hidden from
+    // all external consumers, SkPicture::createBBoxHierarchy can also be
+    // cleaned up.
+private:
+#endif
+    enum Deprecated_RecordingFlags {
         /*  This flag causes the picture to compute bounding boxes and build
             up a spatial hierarchy (currently an R-Tree), plus a tree of Canvas'
             usually stack-based clip/etc state. This requires an increase in
@@ -159,6 +168,9 @@ public:
         */
         kOptimizeForClippedPlayback_RecordingFlag = 0x02,
     };
+#ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS
+public:
+#endif
 
 #ifndef SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD
 private:
@@ -337,6 +349,7 @@ protected:
     // For testing. Derived classes may instantiate an alternate
     // SkBBoxHierarchy implementation
     virtual SkBBoxHierarchy* createBBoxHierarchy() const;
+
 private:
     // An OperationList encapsulates a set of operation offsets into the picture byte
     // stream along with the CTMs needed for those operation.
@@ -406,6 +419,9 @@ public:
      *  Allocate a new SkPicture. Return NULL on failure.
      */
     virtual SkPicture* create(int width, int height) = 0;
+
+private:
+    typedef SkRefCnt INHERITED;
 };
 
 class SK_API SkPictureRecorder : SkNoncopyable {
@@ -428,6 +444,7 @@ public:
     SkCanvas* beginRecording(int width, int height, uint32_t recordFlags = 0) {
         if (NULL != fFactory) {
             fPicture.reset(fFactory->create(width, height));
+            recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
         } else {
             fPicture.reset(SkNEW(SkPicture));
         }
diff --git a/include/core/SkRTreePicture.h b/include/core/SkRTreePicture.h
new file mode 100644 (file)
index 0000000..d691111
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkRTreePicture_DEFINED
+#define SkRTreePicture_DEFINED
+
+#include "SkPicture.h"
+
+/**
+ * Subclass of SkPicture that creates an RTree acceleration structure. 
+ */
+class SkRTreePicture : public SkPicture {
+public:
+    virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
+
+private:
+    typedef SkPicture INHERITED;
+};
+
+class SkRTreePictureFactory : public SkPictureFactory {
+public:
+    SkRTreePictureFactory() {}
+
+    virtual SkPicture* create(int width, int height) SK_OVERRIDE {
+        return SkNEW(SkRTreePicture);
+    }
+
+private:
+    typedef SkPictureFactory INHERITED;
+};
+
+#endif
index b6fd01dd92442e88119812dd81b9e4eebc39bf41..25947ad694d27ad4c950b592b78e304849be3512 100644 (file)
 #include "SkSize.h"
 
 /**
- * Subclass of SkPicture that override the behavior of the
- * kOptimizeForClippedPlayback_RecordingFlag by creating an SkTileGrid
- * structure rather than an R-Tree. The tile grid has lower recording
- * and playback costs, but is less effective at eliminating extraneous
+ * Subclass of SkPicture that creates an SkTileGrid. The tile grid has lower recording
+ * and playback costs then rTree, but is less effective at eliminating extraneous
  * primitives for arbitrary query rectangles. It is most effective for
  * tiled playback when the tile structure is known at record time.
  */
index ab45555e91699b00cc2b2ba57418578bcfeae513..11bd1f057bcb943900990a6d093bf518d19251e5 100644 (file)
@@ -18,6 +18,7 @@
 #include "SkQuadTreePicture.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
+#include "SkRTreePicture.h"
 #include "SkShader.h"
 #include "SkTileGridPicture.h"
 #include "SkUtils.h"
@@ -166,6 +167,7 @@ private:
             // no bbox playback necessary
             return pic.detach();
         case kRTree_BBoxType:
+            factory.reset(SkNEW(SkRTreePictureFactory));
             break;
         case kQuadTree_BBoxType:
             factory.reset(SkNEW(SkQuadTreePictureFactory));
@@ -184,8 +186,7 @@ private:
         }
 
         SkPictureRecorder recorder(factory);
-        pic->draw(recorder.beginRecording(pic->width(), pic->height(),
-                                          SkPicture::kOptimizeForClippedPlayback_RecordingFlag));
+        pic->draw(recorder.beginRecording(pic->width(), pic->height()));
         return recorder.endRecording();
     }
 
index d805fc52a2239a1b75885e611b82042cb7f25775..986dc424c9b9e467d39ac06e72d76dbeab030273 100644 (file)
@@ -253,6 +253,10 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
 }
 
 SkBBoxHierarchy* SkPicture::createBBoxHierarchy() const {
+    // TODO: this code is now replicated in SkRTreePicture. Once all external
+    // clients have been weaned off of kOptimizeForClippedPlayback_RecordingFlag,
+    // this code can be removed.
+
     // These values were empirically determined to produce reasonable
     // performance in most cases.
     static const int kRTreeMinChildren = 6;
index 67e6658debeed7fe79602b2cf8392a542d26c332..811383b668b979556bd9114ee08cabb0db5861d3 100644 (file)
@@ -12,9 +12,8 @@
 #include "SkRect.h"
 
 /**
- * Subclass of SkPicture that override the behavior of the
- * kOptimizeForClippedPlayback_RecordingFlag by creating an SkQuadGrid
- * structure rather than an R-Tree. The quad tree has generally faster
+ * Subclass of SkPicture that creates an SkQuadGrid
+ * structure. The quad tree has generally faster
  * tree creation time, but slightly slower query times, as compared to
  * R-Tree, so some cases may be faster and some cases slower.
  */
@@ -29,7 +28,9 @@ private:
 };
 
 class SkQuadTreePictureFactory : public SkPictureFactory {
-private:
+public:
+    SkQuadTreePictureFactory() {}
+
     virtual SkPicture* create(int width, int height) SK_OVERRIDE {
         return SkNEW_ARGS(SkQuadTreePicture, (SkIRect::MakeWH(width, height)));
     }
diff --git a/src/core/SkRTreePicture.cpp b/src/core/SkRTreePicture.cpp
new file mode 100644 (file)
index 0000000..87c94e5
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkRTreePicture.h"
+
+#include "SkRTree.h"
+
+
+SkBBoxHierarchy* SkRTreePicture::createBBoxHierarchy() const {
+    // These values were empirically determined to produce reasonable
+    // performance in most cases.
+    static const int kRTreeMinChildren = 6;
+    static const int kRTreeMaxChildren = 11;
+
+    SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(fWidth),
+                                       SkIntToScalar(fHeight));
+    bool sortDraws = false;  // Do not sort draw calls when bulk loading.
+
+    return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
+                           aspectRatio, sortDraws);
+}
index acc9bd517faad1431d14082aac11f7117e5c35f9..cfa7c6f79dd70520343457fb0040bac76f0f4186 100644 (file)
@@ -24,6 +24,7 @@
 #include "SkMorphologyImageFilter.h"
 #include "SkOffsetImageFilter.h"
 #include "SkPicture.h"
+#include "SkRTreePicture.h"
 #include "SkRect.h"
 #include "SkTileImageFilter.h"
 #include "SkXfermodeImageFilter.h"
@@ -276,9 +277,9 @@ DEF_TEST(ImageFilterMatrixTest, reporter) {
 
     SkMatrix expectedMatrix = canvas.getTotalMatrix();
 
-    SkPictureRecorder recorder;
-    SkCanvas* recordingCanvas = recorder.beginRecording(100, 100,
-        SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
+    SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkRTreePictureFactory));
+    SkPictureRecorder recorder(factory);
+    SkCanvas* recordingCanvas = recorder.beginRecording(100, 100);
 
     SkPaint paint;
     SkAutoTUnref<MatrixTestImageFilter> imageFilter(
index defb2e93ed626767a5e729012110d21e4a6ee548..81abd8b661344db46ae4409e4a8d4c91c58109f5 100644 (file)
@@ -19,6 +19,7 @@
 #include "SkQuadTreePicture.h"
 #include "SkRRect.h"
 #include "SkRandom.h"
+#include "SkRTreePicture.h"
 #include "SkShader.h"
 #include "SkStream.h"
 #include "SkTileGrid.h"
@@ -917,7 +918,7 @@ static void test_draw_empty(skiatest::Reporter* reporter) {
 
         SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (gridInfo)));
         SkPictureRecorder recorder(factory);
-        recorder.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
+        recorder.beginRecording(1, 1);
         SkAutoTUnref<SkPicture> picture(recorder.endRecording());
 
         canvas.drawPicture(*picture);
@@ -925,8 +926,9 @@ static void test_draw_empty(skiatest::Reporter* reporter) {
 
     {
         // RTree
-        SkPictureRecorder recorder;
-        recorder.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
+        SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkRTreePictureFactory));
+        SkPictureRecorder recorder(factory);
+        recorder.beginRecording(1, 1);
         SkAutoTUnref<SkPicture> picture(recorder.endRecording());
 
         canvas.drawPicture(*picture);
@@ -936,7 +938,7 @@ static void test_draw_empty(skiatest::Reporter* reporter) {
         // quad tree
         SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkQuadTreePictureFactory));
         SkPictureRecorder recorder(factory);
-        recorder.beginRecording(1, 1, SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
+        recorder.beginRecording(1, 1);
         SkAutoTUnref<SkPicture> picture(recorder.endRecording());
 
         canvas.drawPicture(*picture);
index 25425fa5bbfc09d5930aa044a17df00f82e475d0..9b5bdebe5431215c66f8ca14cee48ddc0deaeb41 100644 (file)
@@ -62,7 +62,7 @@ DEF_TEST(TileGrid_UnalignedQuery, reporter) {
                                     SkIntToScalar(1), SkIntToScalar(1));
     SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (info)));
     SkPictureRecorder recorder(factory);
-    SkCanvas* canvas = recorder.beginRecording(20, 20, SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
+    SkCanvas* canvas = recorder.beginRecording(20, 20);
     SkPaint paint;
     canvas->drawRect(rect1, paint);
     canvas->drawRect(rect2, paint);
@@ -151,7 +151,7 @@ DEF_TEST(TileGrid_OverlapOffsetQueryAlignment, reporter) {
                                     SkIntToScalar(1), SkIntToScalar(1));
     SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (info)));
     SkPictureRecorder recorder(factory);
-    SkCanvas* canvas = recorder.beginRecording(20, 20, SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
+    SkCanvas* canvas = recorder.beginRecording(20, 20);
     SkPaint paint;
     canvas->drawRect(rect1, paint);
     canvas->drawRect(rect2, paint);
index 59e4948da04dc813446c1c6b8516b0913684b82a..b669e15f47d9c5f6fd4d84f6042b4414d819c8ca 100644 (file)
@@ -28,7 +28,7 @@
 #include "SkPixelRef.h"
 #include "SkQuadTree.h"
 #include "SkQuadTreePicture.h"
-#include "SkRTree.h"
+#include "SkRTreePicture.h"
 #include "SkScalar.h"
 #include "SkStream.h"
 #include "SkString.h"
@@ -319,9 +319,9 @@ void PictureRenderer::purgeTextures() {
 }
 
 uint32_t PictureRenderer::recordFlags() {
-    return ((kNone_BBoxHierarchyType == fBBoxHierarchyType) ? 0 :
-        SkPicture::kOptimizeForClippedPlayback_RecordingFlag) |
-        SkPicture::kUsePathBoundsForClip_RecordingFlag;
+    return (kNone_BBoxHierarchyType == fBBoxHierarchyType) 
+                            ? 0
+                            : SkPicture::kUsePathBoundsForClip_RecordingFlag;
 }
 
 /**
@@ -975,29 +975,6 @@ SkString PlaybackCreationRenderer::getConfigNameInternal() {
 ///////////////////////////////////////////////////////////////////////////////////////////////
 // SkPicture variants for each BBoxHierarchy type
 
-class RTreePicture : public SkPicture {
-public:
-    virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE {
-        static const int kRTreeMinChildren = 6;
-        static const int kRTreeMaxChildren = 11;
-        SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(fWidth),
-                                           SkIntToScalar(fHeight));
-        bool sortDraws = false;
-        return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
-                               aspectRatio, sortDraws);
-    }
-};
-
-class SkRTreePictureFactory : public SkPictureFactory {
-private:
-    virtual SkPicture* create(int width, int height) SK_OVERRIDE {
-        return SkNEW(RTreePicture);
-    }
-
-private:
-    typedef SkPictureFactory INHERITED;
-};
-
 SkPictureFactory* PictureRenderer::getFactory() {
     switch (fBBoxHierarchyType) {
         case kNone_BBoxHierarchyType:
index ae91eb119a5383b760cac6a149d3261f7c6e95eb..0798de21e79901e777232d81c7b570223c01b23d 100644 (file)
@@ -12,6 +12,7 @@
 #include "SkPicture.h"
 #include "SkQuadTreePicture.h"
 #include "SkRecording.h"
+#include "SkRTreePicture.h"
 #include "SkStream.h"
 #include "SkString.h"
 #include "SkTileGridPicture.h"
@@ -33,19 +34,17 @@ DEFINE_int32(tileGridSize, 512, "Set the tile grid size. Has no effect if bbh is
 DEFINE_string(bbh, "", "Turn on the bbh and select the type, one of rtree, tilegrid, quadtree");
 DEFINE_bool(skr, false, "Record SKR instead of SKP.");
 
-typedef SkPictureFactory* (*PictureFactory)(int* recordingFlags);
+typedef SkPictureFactory* (*PictureFactory)();
 
-static SkPictureFactory* vanilla_factory(int* recordingFlags) {
+static SkPictureFactory* vanilla_factory() {
     return NULL;
 }
 
-static SkPictureFactory* rtree_factory(int* recordingFlags) {
-    *recordingFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
-    return NULL;
+static SkPictureFactory* rtree_factory() {
+    return SkNEW(SkRTreePictureFactory);
 }
 
-static SkPictureFactory* tilegrid_factory(int* recordingFlags) {
-    *recordingFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
+static SkPictureFactory* tilegrid_factory() {
     SkTileGridPicture::TileGridInfo info;
     info.fTileInterval.set(FLAGS_tileGridSize, FLAGS_tileGridSize);
     info.fMargin.setEmpty();
@@ -53,8 +52,7 @@ static SkPictureFactory* tilegrid_factory(int* recordingFlags) {
     return SkNEW_ARGS(SkTileGridPictureFactory, (info));
 }
 
-static SkPictureFactory* quadtree_factory(int* recordingFlags) {
-    *recordingFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
+static SkPictureFactory* quadtree_factory() {
     return SkNEW(SkQuadTreePictureFactory);
 }
 
@@ -94,7 +92,7 @@ static void bench_record(SkPicture* src, const char* name, PictureFactory pictur
             SkDELETE(SkRecording::Delete(recording));  // delete the SkPlayback*.
         } else {
             int recordingFlags = FLAGS_flags;
-            SkAutoTUnref<SkPictureFactory> factory(pictureFactory(&recordingFlags));
+            SkAutoTUnref<SkPictureFactory> factory(pictureFactory());
             SkPictureRecorder recorder(factory);
             SkCanvas* canvas = recorder.beginRecording(width, height, recordingFlags);
             if (NULL != src) {