aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-12-02 09:11:25 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-02 09:11:25 -0800
commit775b8199a214af57c3ea7969e9d456f5f3eb137f (patch)
treeb4729e4aea47f46a371957cf713a4cc135717a3d /src/images
parentba1bf8af8d63ce866e3099c410228ba814491957 (diff)
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
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkDecodingImageGenerator.cpp3
-rw-r--r--src/images/SkImageDecoder_libjpeg.cpp3
-rw-r--r--src/images/SkImageDecoder_libpng.cpp11
-rw-r--r--src/images/SkImageDecoder_libwebp.cpp3
-rw-r--r--src/images/SkImageEncoder_argb.cpp3
5 files changed, 9 insertions, 14 deletions
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index cdee7c1676..d5c2ba8818 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -199,8 +199,7 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info,
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 4f78865154..77d1c5feff 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -1355,7 +1355,6 @@ protected:
// 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 @@ protected:
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 0890eaacaf..8a3e40ea19 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -413,8 +413,8 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
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 @@ bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
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 int computeBitDepth(int colorCount) {
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 8bf15c92e6..2a7bb0fe59 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -621,7 +621,6 @@ bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
}
SkAutoLockPixels alp(bm);
- SkAutoLockColors ctLocker;
if (NULL == bm.getPixels()) {
return false;
}
@@ -638,7 +637,7 @@ bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
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 296491eef8..02d5490452 100644
--- a/src/images/SkImageEncoder_argb.cpp
+++ b/src/images/SkImageEncoder_argb.cpp
@@ -98,8 +98,7 @@ bool SkARGBImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int
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]);