aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-07 18:26:22 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-07 18:26:22 +0000
commit2b4e370a2fe00168838e43f5a78ccc3b371609f5 (patch)
treeb4a5b60609c6d24f01f575a4f97ca98dd2897c73 /src
parentc96268d792e8807e0f5ba71fc70caa9f0357edf3 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPicture.cpp18
-rw-r--r--src/gpu/GrLayerCache.cpp10
-rw-r--r--src/gpu/GrLayerCache.h2
3 files changed, 15 insertions, 15 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 6737201971..e67830e223 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -140,7 +140,7 @@ SkPicture::SkPicture(const SkPicture& src)
if (src.fPlayback) {
fPlayback = SkNEW_ARGS(SkPicturePlayback, (*src.fPlayback));
SkASSERT(NULL == src.fRecord);
- fGenerationID = src.getGenerationID(); // need to call method to ensure != 0
+ fUniqueID = src.uniqueID(); // need to call method to ensure != 0
} else if (src.fRecord) {
SkPictInfo info;
this->createHeader(&info);
@@ -164,7 +164,7 @@ void SkPicture::internalOnly_EnableOpts(bool enableOpts) {
}
void SkPicture::swap(SkPicture& other) {
- SkTSwap(fGenerationID, other.fGenerationID);
+ SkTSwap(fUniqueID, other.fUniqueID);
SkTSwap(fRecord, other.fRecord);
SkTSwap(fPlayback, other.fPlayback);
SkTSwap(fAccelData, other.fAccelData);
@@ -199,7 +199,7 @@ void SkPicture::clone(SkPicture* pictures, int count) const {
if (fPlayback) {
clone->fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fPlayback, &copyInfo));
SkASSERT(NULL == fRecord);
- clone->fGenerationID = this->getGenerationID(); // need to call method to ensure != 0
+ clone->fUniqueID = this->uniqueID(); // need to call method to ensure != 0
} else if (fRecord) {
// here we do a fake src.endRecording()
clone->fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fRecord, info, true));
@@ -506,18 +506,18 @@ static int32_t next_picture_generation_id() {
int32_t genID;
do {
genID = sk_atomic_inc(&gPictureGenerationID) + 1;
- } while (((int32_t)SkPicture::kInvalidGenID) == genID);
+ } while (SK_InvalidGenID == genID);
return genID;
}
-uint32_t SkPicture::getGenerationID() const {
+uint32_t SkPicture::uniqueID() const {
if (NULL != fRecord) {
SkASSERT(NULL == fPlayback);
- return kInvalidGenID;
+ return SK_InvalidGenID;
}
- if (kInvalidGenID == fGenerationID) {
- fGenerationID = next_picture_generation_id();
+ if (SK_InvalidGenID == fUniqueID) {
+ fUniqueID = next_picture_generation_id();
}
- return fGenerationID;
+ return fUniqueID;
}
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp
index 12da5893a3..9305d1a2dd 100644
--- a/src/gpu/GrLayerCache.cpp
+++ b/src/gpu/GrLayerCache.cpp
@@ -69,16 +69,16 @@ void GrLayerCache::freeAll() {
GrAtlasedLayer* GrLayerCache::createLayer(SkPicture* picture, int layerID) {
GrAtlasedLayer* layer = fLayerPool.alloc();
- SkASSERT(picture->getGenerationID() != SkPicture::kInvalidGenID);
- layer->init(picture->getGenerationID(), layerID);
- fLayerHash.insert(PictureLayerKey(picture->getGenerationID(), layerID), layer);
+ SkASSERT(picture->uniqueID() != SK_InvalidGenID);
+ layer->init(picture->uniqueID(), layerID);
+ fLayerHash.insert(PictureLayerKey(picture->uniqueID(), layerID), layer);
return layer;
}
const GrAtlasedLayer* GrLayerCache::findLayerOrCreate(SkPicture* picture, int layerID) {
- SkASSERT(picture->getGenerationID() != SkPicture::kInvalidGenID);
- GrAtlasedLayer* layer = fLayerHash.find(PictureLayerKey(picture->getGenerationID(), layerID));
+ SkASSERT(picture->uniqueID() != SK_InvalidGenID);
+ GrAtlasedLayer* layer = fLayerHash.find(PictureLayerKey(picture->uniqueID(), layerID));
if (NULL == layer) {
layer = this->createLayer(picture, layerID);
}
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index eef20ff23e..0624736338 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -47,7 +47,7 @@ private:
// It is roughly equivalent to a GrGlyph in the font caching system
class GrAtlasedLayer {
public:
- GrAtlasedLayer() : fPictureID(SkPicture::kInvalidGenID) { }
+ GrAtlasedLayer() : fPictureID(SK_InvalidGenID) { }
uint32_t pictureID() const { return fPictureID; }
int layerID() const { return fLayerID; }