Try out scalar picture sizes

This paves the way for removing the 'fTile' parameter from SkPictureShader (although that should be a different CL). If we like this we could also move to providing an entire cull SkRect.

R=reed@google.com, mtklein@google.com, fmalita@google.com, fmalita@chromium.org

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/513983002
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 30d0821..6a54040 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -120,19 +120,16 @@
     */
     void draw(SkCanvas* canvas, SkDrawPictureCallback* = NULL) const;
 
-    /** Return the width of the picture's recording canvas. This
-        value reflects what was passed to setSize(), and does not necessarily
-        reflect the bounds of what has been recorded into the picture.
-        @return the width of the picture's recording canvas
-    */
-    int width() const { return fWidth; }
+#ifdef SK_LEGACY_PICTURE_SIZE_API
+    int width() const  { return SkScalarCeilToInt(fCullWidth); }
+    int height() const { return SkScalarCeilToInt(fCullHeight); }
+#endif
 
-    /** Return the height of the picture's recording canvas. This
-        value reflects what was passed to setSize(), and does not necessarily
-        reflect the bounds of what has been recorded into the picture.
-        @return the height of the picture's recording canvas
+    /** Return the cull rect used when creating this picture: { 0, 0, cullWidth, cullHeight }.
+        It does not necessarily reflect the bounds of what has been recorded into the picture.
+        @return the cull rect used to create this picture
     */
-    int height() const { return fHeight; }
+    const SkRect cullRect() const { return SkRect::MakeWH(fCullWidth, fCullHeight); }
 
     /** Return a non-zero, unique value representing the picture. This call is
         only valid when not recording. Between a beginRecording/endRecording
@@ -180,7 +177,7 @@
         If false is returned, SkPictInfo is unmodified.
     */
     static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*);
-    static bool InternalOnly_BufferIsSKP(SkReadBuffer&, SkPictInfo*);
+    static bool InternalOnly_BufferIsSKP(SkReadBuffer*, SkPictInfo*);
 
     /** Return true if the picture is suitable for rendering on the GPU.
      */
@@ -244,19 +241,21 @@
     // V32: Removed SkPaintOptionsAndroid from SkPaint
     // V33: Serialize only public API of effects.
     // V34: Add SkTextBlob serialization.
+    // V35: Store SkRect (rather then width & height) in header
 
     // Note: If the picture version needs to be increased then please follow the
     // steps to generate new SKPs in (only accessible to Googlers): http://goo.gl/qATVcw
 
     // Only SKPs within the min/current picture version range (inclusive) can be read.
     static const uint32_t MIN_PICTURE_VERSION = 19;
-    static const uint32_t CURRENT_PICTURE_VERSION = 34;
+    static const uint32_t CURRENT_PICTURE_VERSION = 35;
 
     mutable uint32_t      fUniqueID;
 
     // TODO: make SkPictureData const when clone method goes away
     SkAutoTDelete<SkPictureData> fData;
-    int                   fWidth, fHeight;
+    const SkScalar                        fCullWidth;
+    const SkScalar                        fCullHeight;
     mutable SkAutoTUnref<const AccelData> fAccelData;
 
     mutable SkTDArray<DeletionListener*> fDeletionListeners;  // pointers are refed
@@ -266,9 +265,9 @@
 
     // Create a new SkPicture from an existing SkPictureData. The new picture
     // takes ownership of 'data'.
-    SkPicture(SkPictureData* data, int width, int height);
+    SkPicture(SkPictureData* data, SkScalar width, SkScalar height);
 
-    SkPicture(int width, int height, const SkPictureRecord& record, bool deepCopyOps);
+    SkPicture(SkScalar width, SkScalar height, const SkPictureRecord& record, bool deepCopyOps);
 
     // An OperationList encapsulates a set of operation offsets into the picture byte
     // stream along with the CTMs needed for those operation.
@@ -303,7 +302,7 @@
     typedef SkRefCnt INHERITED;
 
     // Takes ownership of the SkRecord, refs the (optional) BBH.
-    SkPicture(int width, int height, SkRecord*, SkBBoxHierarchy*);
+    SkPicture(SkScalar width, SkScalar height, SkRecord*, SkBBoxHierarchy*);
     // Return as a new SkPicture that's backed by SkRecord.
     static SkPicture* Forwardport(const SkPicture&);