Chromium Code Reviews| Index: include/core/SkPicture.h |
| diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h |
| index 1eff2c6e6516332d46c9ceff929f51af89171e91..f918346b782c6f4ee68acd9a389f2a4ee53c5c08 100644 |
| --- a/include/core/SkPicture.h |
| +++ b/include/core/SkPicture.h |
| @@ -120,19 +120,16 @@ public: |
| */ |
| 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 @@ public: |
| 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*); |
|
reed1
2014/08/28 20:54:18
funny that this change is part of this CL
|
| /** Return true if the picture is suitable for rendering on the GPU. |
| */ |
| @@ -244,19 +241,21 @@ private: |
| // 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 @@ private: |
| // 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 @@ private: |
| 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&); |