SkColorTable locking serves no purpose anymore.
The only thing the unlock methods were doing was assert their balance.
This removes the unlock methods and renames the lock methods "read".
BUG=skia:
Review URL: https://codereview.chromium.org/719213008
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index f0ad029..d644ecb 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -284,20 +284,20 @@
if (!this->setInfo(requestedInfo, rowBytes)) {
return reset_return_false(this);
}
-
+
// setInfo may have corrected info (e.g. 565 is always opaque).
const SkImageInfo& correctedInfo = this->info();
// setInfo may have computed a valid rowbytes if 0 were passed in
rowBytes = this->rowBytes();
SkMallocPixelRef::PRFactory defaultFactory;
-
+
SkPixelRef* pr = defaultFactory.create(correctedInfo, rowBytes, NULL);
if (NULL == pr) {
return reset_return_false(this);
}
this->setPixelRef(pr)->unref();
-
+
// TODO: lockPixels could/should return bool or void*/NULL
this->lockPixels();
if (NULL == this->getPixels()) {
@@ -586,11 +586,10 @@
return true;
} break;
case kIndex_8_SkColorType: {
- SkAutoLockColors alc(bm);
- const SkPMColor* table = alc.colors();
- if (!table) {
+ if (!bm.getColorTable()) {
return false;
}
+ const SkPMColor* table = bm.getColorTable()->readColors();
SkPMColor c = (SkPMColor)~0;
for (int i = bm.getColorTable()->count() - 1; i >= 0; --i) {
c &= table[i];
@@ -848,15 +847,15 @@
if (0 == requestedDstInfo.width() || 0 == requestedDstInfo.height()) {
return false;
}
-
+
SkIRect srcR = SkIRect::MakeXYWH(x, y, requestedDstInfo.width(), requestedDstInfo.height());
if (!srcR.intersect(0, 0, this->width(), this->height())) {
return false;
}
-
+
// the intersect may have shrunk info's logical size
const SkImageInfo dstInfo = requestedDstInfo.makeWH(srcR.width(), srcR.height());
-
+
// if x or y are negative, then we have to adjust pixels
if (x > 0) {
x = 0;
@@ -868,16 +867,16 @@
dstPixels = ((char*)dstPixels - y * dstRB - x * dstInfo.bytesPerPixel());
//////////////
-
+
SkAutoLockPixels alp(*this);
-
+
// since we don't stop creating un-pixeled devices yet, check for no pixels here
if (NULL == this->getPixels()) {
return false;
}
-
+
const SkImageInfo srcInfo = this->info().makeWH(dstInfo.width(), dstInfo.height());
-
+
const void* srcPixels = this->getAddr(srcR.x(), srcR.y());
return SkPixelInfo::CopyPixels(dstInfo, dstPixels, dstRB, srcInfo, srcPixels, this->rowBytes(),
this->getColorTable());
@@ -1067,7 +1066,7 @@
} else if (kIndex_8_SkColorType == colorType && !src.isOpaque()) {
SkColorTable* ct = src.getColorTable();
if (ct) {
- const SkPMColor* SK_RESTRICT table = ct->lockColors();
+ const SkPMColor* SK_RESTRICT table = ct->readColors();
const uint8_t* SK_RESTRICT s = src.getAddr8(0, 0);
while (--h >= 0) {
for (int x = 0; x < w; x++) {
@@ -1076,7 +1075,6 @@
s += rb;
alpha += alphaRowBytes;
}
- ct->unlockColors();
}
} else { // src is opaque, so just fill alpha[] with 0xFF
memset(alpha, 0xFF, h * alphaRowBytes);
diff --git a/src/core/SkBitmapProcState_procs.h b/src/core/SkBitmapProcState_procs.h
index 0d3b723..3b4cef3 100644
--- a/src/core/SkBitmapProcState_procs.h
+++ b/src/core/SkBitmapProcState_procs.h
@@ -154,10 +154,10 @@
#define SRCTYPE uint8_t
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fAlphaScale == 256)
-#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
+#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->readColors()
#define RETURNDST(src) table[src]
#define SRC_TO_FILTER(src) table[src]
-#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
+#define POSTAMBLE(state)
#include "SkBitmapProcState_sample.h"
#undef FILTER_PROC
@@ -169,10 +169,10 @@
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fAlphaScale < 256)
#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale; \
- const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
+ const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->readColors()
#define RETURNDST(src) SkAlphaMulQ(table[src], alphaScale)
#define SRC_TO_FILTER(src) table[src]
-#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
+#define POSTAMBLE(state)
#include "SkBitmapProcState_sample.h"
// SRC == 4444
@@ -280,10 +280,10 @@
#define SRCTYPE uint8_t
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fBitmap->isOpaque())
-#define PREAMBLE(state) const uint16_t* SK_RESTRICT table = state.fBitmap->getColorTable()->lock16BitCache()
+#define PREAMBLE(state) const uint16_t* SK_RESTRICT table = state.fBitmap->getColorTable()->read16BitCache()
#define RETURNDST(src) table[src]
#define SRC_TO_FILTER(src) table[src]
-#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlock16BitCache()
+#define POSTAMBLE(state)
#include "SkBitmapProcState_sample.h"
///////////////////////////////////////////////////////////////////////////////
@@ -335,9 +335,9 @@
#define SRCTYPE uint8_t
#define DSTTYPE uint32_t
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType())
-#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
+#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->readColors()
#define SRC_TO_FILTER(src) table[src]
-#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
+#define POSTAMBLE(state)
#include "SkBitmapProcState_shaderproc.h"
#undef NAME_WRAP
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index 0d033ec..cb9f00c 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -19,11 +19,8 @@
f16BitCache = NULL;
fCount = count;
fColors = reinterpret_cast<SkPMColor*>(sk_malloc_throw(count * sizeof(SkPMColor)));
-
+
memcpy(fColors, colors, count * sizeof(SkPMColor));
-
- SkDEBUGCODE(fColorLockCount = 0;)
- SkDEBUGCODE(f16BitCacheLockCount = 0;)
}
// As copy constructor is hidden in the class hierarchy, we need to call
@@ -43,18 +40,10 @@
}
SkColorTable::~SkColorTable() {
- SkASSERT(fColorLockCount == 0);
- SkASSERT(f16BitCacheLockCount == 0);
-
sk_free(fColors);
sk_free(f16BitCache);
}
-void SkColorTable::unlockColors() {
- SkASSERT(fColorLockCount != 0);
- SkDEBUGCODE(sk_atomic_dec(&fColorLockCount);)
-}
-
#include "SkColorPriv.h"
static inline void build_16bitcache(uint16_t dst[], const SkPMColor src[],
@@ -64,13 +53,11 @@
}
}
-const uint16_t* SkColorTable::lock16BitCache() {
+const uint16_t* SkColorTable::read16BitCache() {
if (NULL == f16BitCache) {
f16BitCache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t));
build_16bitcache(f16BitCache, fColors, fCount);
}
-
- SkDEBUGCODE(sk_atomic_inc(&f16BitCacheLockCount));
return f16BitCache;
}
@@ -78,9 +65,6 @@
SkColorTable::SkColorTable(SkReadBuffer& buffer) {
f16BitCache = NULL;
- SkDEBUGCODE(fColorLockCount = 0;)
- SkDEBUGCODE(f16BitCacheLockCount = 0;)
-
if (buffer.isVersionLT(SkReadBuffer::kRemoveColorTableAlpha_Version)) {
/*fAlphaType = */buffer.readUInt();
}
diff --git a/src/core/SkConfig8888.cpp b/src/core/SkConfig8888.cpp
index b0572c0..8b47a20 100644
--- a/src/core/SkConfig8888.cpp
+++ b/src/core/SkConfig8888.cpp
@@ -154,13 +154,13 @@
dstPI.fAlphaType = dstInfo.alphaType();
dstPI.fPixels = dstPixels;
dstPI.fRowBytes = dstRB;
-
+
SkSrcPixelInfo srcPI;
srcPI.fColorType = srcInfo.colorType();
srcPI.fAlphaType = srcInfo.alphaType();
srcPI.fPixels = srcPixels;
srcPI.fRowBytes = srcRB;
-
+
return srcPI.convertPixelsTo(&dstPI, width, height);
}
@@ -196,13 +196,13 @@
// Our method for converting to 4444 assumes premultiplied.
return false;
}
-
+
const SkPMColor* table = NULL;
if (kIndex_8_SkColorType == srcInfo.colorType()) {
if (NULL == ctable) {
return false;
}
- table = ctable->lockColors();
+ table = ctable->readColors();
}
for (int y = 0; y < height; ++y) {
@@ -222,10 +222,6 @@
dstPixels = (char*)dstPixels + dstRB;
srcPixels = (const char*)srcPixels + srcRB;
}
-
- if (table) {
- ctable->unlockColors();
- }
return true;
}
diff --git a/src/core/SkProcSpriteBlitter.cpp b/src/core/SkProcSpriteBlitter.cpp
index 2b535d9..619088a 100644
--- a/src/core/SkProcSpriteBlitter.cpp
+++ b/src/core/SkProcSpriteBlitter.cpp
@@ -26,7 +26,7 @@
const SkPMColor* ctable = NULL;
if fSource.getColorTable())
- ctable = fSource.getColorTable()->lockColors();
+ ctable = fSource.getColorTable()->readColors();
while (--height >= 0)
{
@@ -34,9 +34,6 @@
dst += dstRB;
src += srcRB;
}
-
- if fSource.getColorTable())
- fSource.getColorTable()->unlockColors();
}
private:
diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp
index 3d1d28d..e2c22dd 100644
--- a/src/core/SkSpriteBlitter_RGB16.cpp
+++ b/src/core/SkSpriteBlitter_RGB16.cpp
@@ -142,10 +142,10 @@
#define SkSPRITE_SRC_TYPE uint8_t
#define SkSPRITE_DST_GETADDR getAddr16
#define SkSPRITE_SRC_GETADDR getAddr8
-#define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getColorTable()->lockColors()
+#define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getColorTable()->readColors()
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Opaque_Pixel(dst, ctable[src])
#define SkSPRITE_NEXT_ROW
-#define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlockColors()
+#define SkSPRITE_POSTAMBLE(srcBM)
#include "SkSpriteBlitterTemplate.h"
#define SkSPRITE_CLASSNAME Sprite_D16_SIndex8A_Blend
@@ -156,10 +156,10 @@
#define SkSPRITE_SRC_TYPE uint8_t
#define SkSPRITE_DST_GETADDR getAddr16
#define SkSPRITE_SRC_GETADDR getAddr8
-#define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getColorTable()->lockColors(); unsigned src_scale = SkAlpha255To256(fSrcAlpha);
+#define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getColorTable()->readColors(); unsigned src_scale = SkAlpha255To256(fSrcAlpha);
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Blend_Pixel(dst, ctable[src], src_scale)
#define SkSPRITE_NEXT_ROW
-#define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlockColors();
+#define SkSPRITE_POSTAMBLE(srcBM)
#include "SkSpriteBlitterTemplate.h"
///////////////////////////////////////////////////////////////////////////////
@@ -234,10 +234,10 @@
#define SkSPRITE_SRC_TYPE uint8_t
#define SkSPRITE_DST_GETADDR getAddr16
#define SkSPRITE_SRC_GETADDR getAddr8
-#define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getColorTable()->lock16BitCache()
+#define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getColorTable()->read16BitCache()
#define SkSPRITE_BLIT_PIXEL(dst, src) *dst = ctable[src]
#define SkSPRITE_NEXT_ROW
-#define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlock16BitCache()
+#define SkSPRITE_POSTAMBLE(srcBM)
#include "SkSpriteBlitterTemplate.h"
#define SkSPRITE_CLASSNAME Sprite_D16_SIndex8_Blend
@@ -248,10 +248,10 @@
#define SkSPRITE_SRC_TYPE uint8_t
#define SkSPRITE_DST_GETADDR getAddr16
#define SkSPRITE_SRC_GETADDR getAddr8
-#define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getColorTable()->lock16BitCache(); unsigned src_scale = SkAlpha255To256(fSrcAlpha);
+#define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getColorTable()->read16BitCache(); unsigned src_scale = SkAlpha255To256(fSrcAlpha);
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S16_Blend_Pixel(dst, ctable[src], src_scale)
#define SkSPRITE_NEXT_ROW
-#define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlock16BitCache();
+#define SkSPRITE_POSTAMBLE(srcBM)
#include "SkSpriteBlitterTemplate.h"
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index a86ee60..d71b05a 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -56,13 +56,11 @@
SkSrcPixelInfo srcPI;
srcPI.fColorType = kN32_SkColorType;
srcPI.fAlphaType = kPremul_SkAlphaType;
- srcPI.fPixels = ctable->lockColors();
+ srcPI.fPixels = ctable->readColors();
srcPI.fRowBytes = count * sizeof(SkPMColor);
srcPI.convertPixelsTo(&dstPI, count, 1);
- ctable->unlockColors();
-
// always skip a full 256 number of entries, even if we memcpy'd fewer
dst += 256 * sizeof(GrColor);
@@ -205,7 +203,7 @@
// then we don't know how to scale the image to match it...
if (ktx.width() != bm.width() || ktx.height() != bm.height()) {
return NULL;
- }
+ }
bytes = ktx.pixelData();
desc.fConfig = kETC1_GrPixelConfig;
@@ -481,7 +479,7 @@
dm = SkXfermode::kISA_Coeff;
}
grPaint->setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm));
-
+
//set the color of the paint to the one of the parameter
grPaint->setColor(paintColor);
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index cdee7c1..d5c2ba8 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -199,8 +199,7 @@
return false;
}
const int count = ctable->count();
- memcpy(ctableEntries, ctable->lockColors(), count * sizeof(SkPMColor));
- ctable->unlockColors();
+ memcpy(ctableEntries, ctable->readColors(), count * sizeof(SkPMColor));
*ctableCount = count;
}
return true;
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 4f78865..77d1c5f 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -1355,7 +1355,6 @@
// allocate these before set call setjmp
SkAutoMalloc oneRow;
- SkAutoLockColors ctLocker;
cinfo.err = jpeg_std_error(&sk_err);
sk_err.error_exit = skjpeg_error_exit;
@@ -1392,7 +1391,7 @@
const int width = bm.width();
uint8_t* oneRowP = (uint8_t*)oneRow.reset(width * 3);
- const SkPMColor* colors = ctLocker.lockColors(bm);
+ const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : NULL;
const void* srcRow = bm.getPixels();
while (cinfo.next_scanline < cinfo.image_height) {
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 0890eaa..8a3e40e 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -413,8 +413,8 @@
even if our decodedBitmap doesn't, due to the request that we
upscale png's palette to a direct model
*/
- SkAutoLockColors ctLock(colorTable);
- if (!sampler.begin(decodedBitmap, sc, *this, ctLock.colors())) {
+ const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL;
+ if (!sampler.begin(decodedBitmap, sc, *this, colors)) {
return kFailure;
}
const int height = decodedBitmap->height();
@@ -894,8 +894,8 @@
even if our decodedBitmap doesn't, due to the request that we
upscale png's palette to a direct model
*/
- SkAutoLockColors ctLock(colorTable);
- if (!sampler.begin(&decodedBitmap, sc, *this, ctLock.colors())) {
+ const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL;
+ if (!sampler.begin(&decodedBitmap, sc, *this, colors)) {
return false;
}
const int height = decodedBitmap.height();
@@ -1047,8 +1047,7 @@
static inline int pack_palette(SkColorTable* ctable,
png_color* SK_RESTRICT palette,
png_byte* SK_RESTRICT trans, bool hasAlpha) {
- SkAutoLockColors alc(ctable);
- const SkPMColor* SK_RESTRICT colors = alc.colors();
+ const SkPMColor* SK_RESTRICT colors = ctable ? ctable->readColors() : NULL;
const int ctCount = ctable->count();
int i, num_trans = 0;
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 8bf15c9..2a7bb0f 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -621,7 +621,6 @@
}
SkAutoLockPixels alp(bm);
- SkAutoLockColors ctLocker;
if (NULL == bm.getPixels()) {
return false;
}
@@ -638,7 +637,7 @@
pic.writer = stream_writer;
pic.custom_ptr = (void*)stream;
- const SkPMColor* colors = ctLocker.lockColors(bm);
+ const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : NULL;
const uint8_t* src = (uint8_t*)bm.getPixels();
const int rgbStride = pic.width * bpp;
diff --git a/src/images/SkImageEncoder_argb.cpp b/src/images/SkImageEncoder_argb.cpp
index 296491e..02d5490 100644
--- a/src/images/SkImageEncoder_argb.cpp
+++ b/src/images/SkImageEncoder_argb.cpp
@@ -98,8 +98,7 @@
return false;
}
- SkAutoLockColors ctLocker;
- const SkPMColor* colors = ctLocker.lockColors(bitmap);
+ const SkPMColor* colors = bitmap.getColorTable() ? bitmap.getColorTable()->readColors() : NULL;
const int argbStride = bitmap.width() * 4;
SkAutoTDeleteArray<uint8_t> ada(new uint8_t[argbStride]);
diff --git a/src/opts/SkBitmapProcState_opts_arm.cpp b/src/opts/SkBitmapProcState_opts_arm.cpp
index 8f24c39..4a84aee 100644
--- a/src/opts/SkBitmapProcState_opts_arm.cpp
+++ b/src/opts/SkBitmapProcState_opts_arm.cpp
@@ -30,7 +30,7 @@
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
- const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->lock16BitCache();
+ const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCache();
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
// buffer is y32, x16, x16, x16, x16, x16
@@ -104,8 +104,6 @@
src = srcAddr[*xx++]; *colors++ = table[src];
}
}
-
- s.fBitmap->getColorTable()->unlock16BitCache();
}
void SI8_opaque_D32_nofilter_DX_arm(
@@ -121,7 +119,7 @@
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
- const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->lockColors();
+ const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors();
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
// buffer is y32, x16, x16, x16, x16, x16
@@ -184,8 +182,6 @@
: "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11"
);
}
-
- s.fBitmap->getColorTable()->unlockColors();
}
#endif // !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
diff --git a/src/opts/SkBitmapProcState_opts_mips_dsp.cpp b/src/opts/SkBitmapProcState_opts_mips_dsp.cpp
index d4f601b..6051cd8 100644
--- a/src/opts/SkBitmapProcState_opts_mips_dsp.cpp
+++ b/src/opts/SkBitmapProcState_opts_mips_dsp.cpp
@@ -18,7 +18,7 @@
SkASSERT(count > 0 && colors != NULL);
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
- const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->lock16BitCache();
+ const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCache();
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height());
srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowBytes());
@@ -142,7 +142,6 @@
src = srcAddr[*xx++]; *colors++ = table[src];
}
}
- s.fBitmap->getColorTable()->unlock16BitCache();
}
static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
@@ -151,7 +150,7 @@
SkASSERT(count > 0 && colors != NULL);
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
- const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->lockColors();
+ const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors();
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowBytes());
@@ -363,7 +362,6 @@
"t4", "t5", "t6", "t7", "t8"
);
}
- s.fBitmap->getColorTable()->unlockColors();
}
/* If we replace a sampleproc, then we null-out the associated shaderproc,