Retract SkPicture::kOptimizeForClippedPlayback_RecordingFlag from public API


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
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 9690469..441833d 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -139,7 +139,16 @@
             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 @@
         */
         kOptimizeForClippedPlayback_RecordingFlag = 0x02,
     };
+#ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS
+public:
+#endif
 
 #ifndef SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD
 private:
@@ -337,6 +349,7 @@
     // 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 @@
      *  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 @@
     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));
         }