Chromium Code Reviews| Index: src/core/SkPicture.cpp |
| diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp |
| index 7f4b33afac0f8e951f2b353da92a2d455212f472..70a6e9a096da9a89e796981d0466a81fe1faefc1 100644 |
| --- a/src/core/SkPicture.cpp |
| +++ b/src/core/SkPicture.cpp |
| @@ -45,6 +45,16 @@ template <typename T> int SafeCount(const T* obj) { |
| return obj ? obj->count() : 0; |
| } |
| +static int32_t gPictureGenerationID; |
|
mtklein
2014/11/21 15:51:56
If find the loop below less clear without "= SK_In
reed1
2014/11/21 15:56:57
Done.
|
| +static int32_t next_picture_generation_id() { |
| + // Loop in case our global wraps around. |
| + int32_t genID; |
| + do { |
| + genID = sk_atomic_inc(&gPictureGenerationID) + 1; |
| + } while (SK_InvalidGenID == genID); |
| + return genID; |
| +} |
| + |
| /////////////////////////////////////////////////////////////////////////////// |
| namespace { |
| @@ -512,33 +522,15 @@ bool SkPicture::hasText() const { return fAnalysis.fHasText; } |
| bool SkPicture::willPlayBackBitmaps() const { return fAnalysis.fWillPlaybackBitmaps; } |
| int SkPicture::approximateOpCount() const { return fRecord->count(); } |
| -static int32_t gPictureGenerationID = SK_InvalidGenID; // This will be set at link time. |
| - |
| -static int32_t next_picture_generation_id() { |
| - // Loop in case our global wraps around. |
| - int32_t genID; |
| - do { |
| - genID = sk_atomic_inc(&gPictureGenerationID) + 1; |
| - } while (SK_InvalidGenID == genID); |
| - return genID; |
| -} |
| - |
| -uint32_t SkPicture::uniqueID() const { |
| - if (SK_InvalidGenID == fUniqueID) { |
| - fUniqueID = next_picture_generation_id(); |
| - } |
| - return fUniqueID; |
| -} |
| - |
| SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SkData* drawablePicts, |
| SkBBoxHierarchy* bbh) |
| - : fCullRect(cullRect) |
| + : fUniqueID(next_picture_generation_id()) |
| + , fCullRect(cullRect) |
| , fRecord(record) |
| , fBBH(SkSafeRef(bbh)) |
| , fDrawablePicts(SkSafeRef(drawablePicts)) |
| - , fAnalysis(*fRecord) { |
| - this->needsNewGenID(); |
| -} |
| + , fAnalysis(*fRecord) |
| +{} |
| // Note that we are assuming that this entry point will only be called from |
| // one thread. Currently the only client of this method is |