Convert SkPicture's generation ID to a unique ID
This CL addresses linger code review comments on r14037 (Add generation ID to SkPicture https://codereview.chromium.org/222683002/)
R=reed@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/225283014
git-svn-id: http://skia.googlecode.com/svn/trunk@14079 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index cfa8c95..baa9486 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -201,14 +201,12 @@
*/
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/
+ pair it will just return 0 (the invalid ID). Each beginRecording/
endRecording pair will cause a different generation ID to be returned.
*/
- uint32_t getGenerationID() const;
+ uint32_t uniqueID() const;
/**
* Function to encode an SkBitmap to an SkData. A function with this
@@ -308,7 +306,7 @@
static const uint32_t MIN_PICTURE_VERSION = 19;
static const uint32_t CURRENT_PICTURE_VERSION = 22;
- mutable uint32_t fGenerationID;
+ mutable uint32_t fUniqueID;
// fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to
// install their own SkPicturePlayback-derived players,SkPictureRecord-derived
@@ -318,7 +316,7 @@
int fWidth, fHeight;
const AccelData* fAccelData;
- void needsNewGenID() { fGenerationID = kInvalidGenID; }
+ void needsNewGenID() { fUniqueID = SK_InvalidGenID; }
// Create a new SkPicture from an existing SkPicturePlayback. Ref count of
// playback is unchanged.
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 9b37604..74ddf02 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -315,6 +315,10 @@
*/
#define SkMSec_LE(a, b) ((int32_t)(a) - (int32_t)(b) <= 0)
+/** The generation IDs in Skia reserve 0 has an invalid marker.
+ */
+#define SK_InvalidGenID 0
+
/****************************************************************************
The rest of these only build with C++
*/