| Index: src/images/SkImageDecoder_libjpeg.cpp
|
| diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
|
| index 3ed38065436637e41d4c12bd9d9a4d1acd9b654e..e79beda1f82d8a51f133a3e2eb636a89d8651c6c 100644
|
| --- a/src/images/SkImageDecoder_libjpeg.cpp
|
| +++ b/src/images/SkImageDecoder_libjpeg.cpp
|
| @@ -357,29 +357,13 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
|
| }
|
|
|
| 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 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
|
| (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 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
|
| }
|
| rowptr += bpr;
|
| }
|
| - if (reuseBitmap) {
|
| - bm->notifyPixelsChanged();
|
| - }
|
| jpeg_finish_decompress(&cinfo);
|
| return true;
|
| }
|
| @@ -481,9 +462,6 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
|
| cinfo.output_height - cinfo.output_scanline)) {
|
| return return_false(cinfo, *bm, "skip rows");
|
| }
|
| - if (reuseBitmap) {
|
| - bm->notifyPixelsChanged();
|
| - }
|
| jpeg_finish_decompress(&cinfo);
|
|
|
| return true;
|
|
|