Index: src/core/SkBitmap.cpp |
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp |
index 2635e130666885e1b98ad35e99ac5ba85922d080..9a116dfc2ed511a90f35bb63f35377fdb824fd7b 100644 |
--- a/src/core/SkBitmap.cpp |
+++ b/src/core/SkBitmap.cpp |
@@ -340,7 +340,7 @@ SkPixelRef* SkBitmap::setPixelRef(SkPixelRef* pr, size_t offset) { |
} |
void SkBitmap::lockPixels() const { |
- if (NULL != fPixelRef && 1 == ++fPixelLockCount) { |
+ if (NULL != fPixelRef && 0 == sk_atomic_inc(&fPixelLockCount)) { |
fPixelRef->lockPixels(); |
this->updatePixelsFromRef(); |
} |
@@ -350,7 +350,7 @@ void SkBitmap::lockPixels() const { |
void SkBitmap::unlockPixels() const { |
SkASSERT(NULL == fPixelRef || fPixelLockCount > 0); |
- if (NULL != fPixelRef && 0 == --fPixelLockCount) { |
+ if (NULL != fPixelRef && 1 == sk_atomic_dec(&fPixelLockCount)) { |
fPixelRef->unlockPixels(); |
this->updatePixelsFromRef(); |
} |