Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: src/core/SkBitmap.cpp

Issue 26734003: Proactive SkPixelRef invalidation (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tweaks Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 05f5208a69bfd62fba985d9f2e54e59d4853bb0d..14487ac136e05d35cea12a28f028080b3342fa55 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1056,7 +1056,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, Config dstConfig, Allocator* alloc) const {
if (tmpSrc.config() == dstConfig && NULL == alloc) {
dst->swap(tmpSrc);
if (dst->pixelRef() && this->config() == dstConfig) {
- dst->pixelRef()->fGenerationID = fPixelRef->getGenerationID();
+ dst->pixelRef()->cloneGenID(*fPixelRef);
scroggo 2013/10/22 21:04:02 So this patch does not address the bug we discusse
bsalomon 2013/10/23 13:52:57 I'd prefer keeping a fix for that as a separate is
mtklein 2013/10/23 15:28:10 Added skia:1742.
scroggo 2013/10/23 15:39:19 I still think it would be nice to document this in
mtklein 2013/10/23 16:07:10 Done.
}
return true;
}
@@ -1096,8 +1096,8 @@ bool SkBitmap::copyTo(SkBitmap* dst, Config dstConfig, Allocator* alloc) const {
if (tmpDst.getSize() == src->getSize()) {
memcpy(tmpDst.getPixels(), src->getPixels(), src->getSafeSize());
SkPixelRef* pixelRef = tmpDst.pixelRef();
- if (pixelRef != NULL) {
- pixelRef->fGenerationID = this->getGenerationID();
+ if (pixelRef != NULL && fPixelRef != NULL) {
bsalomon 2013/10/23 13:52:57 ubernbit: NULL != pixelRef
mtklein 2013/10/23 15:28:10 Done.
+ pixelRef->cloneGenID(*fPixelRef);
}
} else {
const char* srcP = reinterpret_cast<const char*>(src->getPixels());
@@ -1151,7 +1151,7 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst, Config dstConfig) const {
if (pixelRef) {
uint32_t rowBytes;
if (dstConfig == fConfig) {
- pixelRef->fGenerationID = fPixelRef->getGenerationID();
+ pixelRef->cloneGenID(*fPixelRef);
// Use the same rowBytes as the original.
rowBytes = fRowBytes;
} else {

Powered by Google App Engine
This is Rietveld 408576698