Remove bitmap reuse from SkImageDecoder.
Now that Android is using an SkBitmap::Allocator to reuse bitmap
memory, remove the unnecessary code to handle bitmap reuse inside
the decoders themselves.
Leaves in the code for bitmap reuse in decodeSubset, which still
may reuse bitmaps, and cropBitmap, which is called by decodeSubset.
R=djsollen@google.com
Review URL: https://codereview.chromium.org/17620004
git-svn-id: http://skia.googlecode.com/svn/trunk@9931 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 4818743..bea1e98 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -357,29 +357,13 @@
}
SkScaledBitmapSampler sampler(cinfo.output_width, cinfo.output_height, sampleSize);
-
- bm->lockPixels();
- JSAMPLE* rowptr = (JSAMPLE*)bm->getPixels();
- bm->unlockPixels();
- bool reuseBitmap = (rowptr != NULL);
-
- if (reuseBitmap) {
- if (sampler.scaledWidth() != bm->width() ||
- sampler.scaledHeight() != bm->height()) {
- // Dimensions must match
- return false;
- } else if (SkImageDecoder::kDecodeBounds_Mode == mode) {
- return true;
- }
- } else {
- bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
- bm->setIsOpaque(true);
- if (SkImageDecoder::kDecodeBounds_Mode == mode) {
- return true;
- }
- if (!this->allocPixelRef(bm, NULL)) {
- return return_false(cinfo, *bm, "allocPixelRef");
- }
+ bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
+ bm->setIsOpaque(true);
+ if (SkImageDecoder::kDecodeBounds_Mode == mode) {
+ return true;
+ }
+ if (!this->allocPixelRef(bm, NULL)) {
+ return return_false(cinfo, *bm, "allocPixelRef");
}
SkAutoLockPixels alp(*bm);
@@ -394,7 +378,7 @@
(config == SkBitmap::kRGB_565_Config &&
cinfo.out_color_space == JCS_RGB_565)))
{
- rowptr = (JSAMPLE*)bm->getPixels();
+ JSAMPLE* rowptr = (JSAMPLE*)bm->getPixels();
INT32 const bpr = bm->rowBytes();
while (cinfo.output_scanline < cinfo.output_height) {
@@ -409,9 +393,6 @@
}
rowptr += bpr;
}
- if (reuseBitmap) {
- bm->notifyPixelsChanged();
- }
jpeg_finish_decompress(&cinfo);
return true;
}
@@ -481,9 +462,6 @@
cinfo.output_height - cinfo.output_scanline)) {
return return_false(cinfo, *bm, "skip rows");
}
- if (reuseBitmap) {
- bm->notifyPixelsChanged();
- }
jpeg_finish_decompress(&cinfo);
return true;