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

Unified Diff: src/core/SkPixelRef.cpp

Issue 1254383006: SkImage_Raster's pixels are always immutable. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « include/core/SkPixelRef.h ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPixelRef.cpp
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 6d36915d9afc37e4878ef5bb98dff2f27c03641a..56bcc9a792ff8a6fab70d9f7ff944992b3c1427a 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -106,7 +106,7 @@ SkPixelRef::SkPixelRef(const SkImageInfo& info)
fRec.zero();
fLockCount = 0;
this->needsNewGenID();
- fIsImmutable = false;
+ fMutability = kMutable;
fPreLocked = false;
fAddedToCache.store(false);
}
@@ -125,7 +125,7 @@ SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex)
fRec.zero();
fLockCount = 0;
this->needsNewGenID();
- fIsImmutable = false;
+ fMutability = kMutable;
fPreLocked = false;
fAddedToCache.store(false);
}
@@ -341,7 +341,7 @@ void SkPixelRef::callGenIDChangeListeners() {
void SkPixelRef::notifyPixelsChanged() {
#ifdef SK_DEBUG
- if (fIsImmutable) {
+ if (this->isImmutable()) {
SkDebugf("========== notifyPixelsChanged called on immutable pixelref");
}
#endif
@@ -355,7 +355,17 @@ void SkPixelRef::changeAlphaType(SkAlphaType at) {
}
void SkPixelRef::setImmutable() {
- fIsImmutable = true;
+ fMutability = kImmutable;
+}
+void SkPixelRef::setTemporarilyImmutable() {
+ SkASSERT(fMutability != kImmutable);
+ fMutability = kTemporarilyImmutable;
+}
+
+void SkPixelRef::restoreMutability() {
+ SkASSERT(fMutability != kImmutable);
+ fMutability = kMutable;
robertphillips 2015/07/29 19:26:29 Hmmm .. can we get rid of the 'notifyPixelsChanged
+ this->notifyPixelsChanged(); // This is just precautionary.
}
bool SkPixelRef::readPixels(SkBitmap* dst, const SkIRect* subset) {
« no previous file with comments | « include/core/SkPixelRef.h ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698