diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-22 15:00:05 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-22 15:00:05 +0000 |
commit | d5764e8ab731dd12df9293e52ce644eaa45333bd (patch) | |
tree | 6e727b0e389ac92469019cad7321f69847f7a662 /src | |
parent | e8e7d5f2753fe93b96cba46be589744caf8af62e (diff) |
When copying a bitmap, copy the generation ID.
Review URL: https://codereview.appspot.com/6462084
git-svn-id: http://skia.googlecode.com/svn/trunk@5227 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmap.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index e59c506983..382d6a1dce 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -892,6 +892,9 @@ bool SkBitmap::copyTo(SkBitmap* dst, Config dstConfig, Allocator* alloc) const { // did we get lucky and we can just return tmpSrc? if (tmpSrc.config() == dstConfig && NULL == alloc) { dst->swap(tmpSrc); + if (dst->pixelRef()) { + dst->pixelRef()->fGenerationID = fPixelRef->getGenerationID(); + } return true; } @@ -926,6 +929,10 @@ bool SkBitmap::copyTo(SkBitmap* dst, Config dstConfig, Allocator* alloc) const { if (src->config() == dstConfig) { if (tmpDst.getSize() == src->getSize()) { memcpy(tmpDst.getPixels(), src->getPixels(), src->getSafeSize()); + SkPixelRef* pixelRef = tmpDst.pixelRef(); + if (pixelRef != NULL) { + pixelRef->fGenerationID = this->getGenerationID(); + } } else { const char* srcP = reinterpret_cast<const char*>(src->getPixels()); char* dstP = reinterpret_cast<char*>(tmpDst.getPixels()); @@ -966,6 +973,9 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst, Config dstConfig) const { if (fPixelRef) { SkPixelRef* pixelRef = fPixelRef->deepCopy(dstConfig); if (pixelRef) { + if (dstConfig == fConfig) { + pixelRef->fGenerationID = fPixelRef->getGenerationID(); + } dst->setConfig(dstConfig, fWidth, fHeight); dst->setPixelRef(pixelRef)->unref(); return true; |