Index: src/images/SkImageDecoder_libjpeg.cpp |
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp |
index 3b3ea887e3cde437d7469d2a43126a2cb604a6eb..13b8e3ea8102302a51cd892bf5f692160ca3fbab 100644 |
--- a/src/images/SkImageDecoder_libjpeg.cpp |
+++ b/src/images/SkImageDecoder_libjpeg.cpp |
@@ -54,12 +54,15 @@ static void overwrite_mem_buffer_size(jpeg_decompress_struct* cinfo) { |
////////////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////////////// |
+static void do_nothing(jpeg_common_struct*, int) { /* do nothing */ } |
scroggo
2013/10/01 22:04:14
Could you make this name more specific? Though it
|
+ |
static void initialize_info(jpeg_decompress_struct* cinfo, skjpeg_source_mgr* src_mgr) { |
SkASSERT(cinfo != NULL); |
SkASSERT(src_mgr != NULL); |
jpeg_create_decompress(cinfo); |
overwrite_mem_buffer_size(cinfo); |
cinfo->src = src_mgr; |
+ cinfo->err->emit_message = &do_nothing; |
scroggo
2013/10/01 22:04:14
Why not do this inside an
#if !defined(SK_DEBUG)
|
} |
#ifdef SK_BUILD_FOR_ANDROID |
@@ -556,7 +559,8 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { |
// if row_count == 0, then we didn't get a scanline, so abort. |
// if we supported partial images, we might return true in this case |
if (0 == row_count) { |
- return return_false(cinfo, *bm, "read_scanlines"); |
+ // Ignore error: return_false(cinfo, *bm, "read_scanlines"); |
scroggo
2013/10/01 22:04:14
This line can be removed. Same for the other cases
|
+ return true; |
scroggo
2013/10/01 22:04:14
Like I said before, this will leave the remainder
|
} |
if (this->shouldCancelDecode()) { |
return return_false(cinfo, *bm, "shouldCancelDecode"); |
@@ -606,7 +610,8 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { |
JSAMPLE* rowptr = (JSAMPLE*)srcRow; |
int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1); |
if (0 == row_count) { |
- return return_false(cinfo, *bm, "read_scanlines"); |
+ // Ignore error: return_false(cinfo, *bm, "read_scanlines"); |
+ return true; |
} |
if (this->shouldCancelDecode()) { |
return return_false(cinfo, *bm, "shouldCancelDecode"); |
@@ -788,7 +793,8 @@ bool SkJPEGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) { |
// if row_count == 0, then we didn't get a scanline, so abort. |
// if we supported partial images, we might return true in this case |
if (0 == rowCount) { |
- return return_false(*cinfo, bitmap, "read_scanlines"); |
+ // Ignore error: return_false(*cinfo, bitmap, "read_scanlines"); |
+ return true; |
} |
if (this->shouldCancelDecode()) { |
return return_false(*cinfo, bitmap, "shouldCancelDecode"); |
@@ -845,7 +851,8 @@ bool SkJPEGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) { |
JSAMPLE* rowptr = (JSAMPLE*)srcRow; |
int row_count = jpeg_read_tile_scanline(cinfo, fImageIndex->huffmanIndex(), &rowptr); |
if (0 == row_count) { |
- return return_false(*cinfo, bitmap, "read_scanlines"); |
+ // Ignore error: return_false(*cinfo, bitmap, "read_scanlines"); |
+ return true; |
} |
if (this->shouldCancelDecode()) { |
return return_false(*cinfo, bitmap, "shouldCancelDecode"); |