diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-15 19:59:45 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-15 19:59:45 +0000 |
commit | 5f62ed74342e44cb1b9671ffdac47c6a81416136 (patch) | |
tree | be22546f4c2be6c18e8f06959882dde987d21d47 /src/core | |
parent | a3b15ed0373b873d4c497b51384b8c07d751753a (diff) |
no need to refcnt colortables, since pixelrefs own them
BUG=skia:
R=halcanary@google.com, scroggo@google.com
Review URL: https://codereview.chromium.org/139463007
git-svn-id: http://skia.googlecode.com/svn/trunk@13098 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBitmap.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 27ea35e974..9a5f1f26dc 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -101,15 +101,7 @@ SkBitmap& SkBitmap::operator=(const SkBitmap& src) { // we reset our locks if we get blown away fPixelLockCount = 0; - /* The src could be in 3 states - 1. no pixelref, in which case we just copy/ref the pixels/ctable - 2. unlocked pixelref, pixels/ctable should be null - 3. locked pixelref, we should lock the ref again ourselves - */ - if (NULL == fPixelRef) { - // leave fPixels as it is - SkSafeRef(fColorTable); // ref the user's ctable if present - } else { // we have a pixelref, so pixels/ctable reflect it + if (fPixelRef) { // ignore the values from the memcpy fPixels = NULL; fColorTable = NULL; @@ -345,14 +337,11 @@ void SkBitmap::updatePixelsFromRef() const { + fPixelRefOrigin.fX * fBytesPerPixel; } fPixels = p; - SkRefCnt_SafeAssign(fColorTable, fPixelRef->colorTable()); + fColorTable = fPixelRef->colorTable(); } else { SkASSERT(0 == fPixelLockCount); fPixels = NULL; - if (fColorTable) { - fColorTable->unref(); - fColorTable = NULL; - } + fColorTable = NULL; } } } @@ -510,11 +499,6 @@ void SkBitmap::freePixels() { // if we're gonna free the pixels, we certainly need to free the mipmap this->freeMipMap(); - if (fColorTable) { - fColorTable->unref(); - fColorTable = NULL; - } - if (NULL != fPixelRef) { if (fPixelLockCount > 0) { fPixelRef->unlockPixels(); @@ -525,6 +509,7 @@ void SkBitmap::freePixels() { } fPixelLockCount = 0; fPixels = NULL; + fColorTable = NULL; } void SkBitmap::freeMipMap() { @@ -1610,7 +1595,6 @@ void SkBitmap::validate() const { #endif SkASSERT(fFlags <= allFlags); SkASSERT(fPixelLockCount >= 0); - SkASSERT(NULL == fColorTable || (unsigned)fColorTable->getRefCnt() < 10000); SkASSERT((uint8_t)ComputeBytesPerPixel((Config)fConfig) == fBytesPerPixel); if (fPixels) { |