From d5500886a29a20733c559c0167a6ae9946704de2 Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Wed, 2 Apr 2014 23:51:13 +0000 Subject: Add generation ID to SkPicture https://codereview.chromium.org/222683002/ git-svn-id: http://skia.googlecode.com/svn/trunk@14037 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkPicture.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'include/core/SkPicture.h') diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 8053bb2405..0985bf8b5f 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -59,10 +59,6 @@ public: typedef SkRefCnt INHERITED; }; - /** The constructor prepares the picture to record. - @param width the width of the virtual device the picture records. - @param height the height of the virtual device the picture records. - */ SkPicture(); /** Make a copy of the contents of src. If src records more drawing after this call, those elements will not appear in this picture. @@ -205,6 +201,15 @@ public: */ int height() const { return fHeight; } + static const uint32_t kInvalidGenID = 0; + + /** Return a non-zero, unique value representing the picture. This call is + only valid when not recording. Between a beginRecording/endRecording + pair it will just return 0 (the invalid gen ID). Each beginRecording/ + endRecording pair will cause a different generation ID to be returned. + */ + uint32_t getGenerationID() const; + /** * Function to encode an SkBitmap to an SkData. A function with this * signature can be passed to serialize() and SkWriteBuffer. @@ -287,7 +292,7 @@ protected: // V13: add flag to drawBitmapRectToRect // parameterize blurs by sigma rather than radius // V14: Add flags word to PathRef serialization - // V15: Remove A1 bitmpa config (and renumber remaining configs) + // V15: Remove A1 bitmap config (and renumber remaining configs) // V16: Move SkPath's isOval flag to SkPathRef // V17: SkPixelRef now writes SkImageInfo // V18: SkBitmap now records x,y for its pixelref origin, instead of offset. @@ -303,6 +308,8 @@ protected: static const uint32_t MIN_PICTURE_VERSION = 19; static const uint32_t CURRENT_PICTURE_VERSION = 22; + mutable uint32_t fGenerationID; + // fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to // install their own SkPicturePlayback-derived players,SkPictureRecord-derived // recorders and set the picture size @@ -311,6 +318,8 @@ protected: int fWidth, fHeight; const AccelData* fAccelData; + void needsNewGenID() { fGenerationID = kInvalidGenID; } + // Create a new SkPicture from an existing SkPicturePlayback. Ref count of // playback is unchanged. SkPicture(SkPicturePlayback*, int width, int height); -- cgit v1.2.3