| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
| 10 #include "SkImageEncoder.h" | 10 #include "SkImageEncoder.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 "images.jpeg.suppressDecoderErrors", | 52 "images.jpeg.suppressDecoderErrors", |
| 53 DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_ERRORS, | 53 DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_ERRORS, |
| 54 "Suppress most JPG error messages when decode " | 54 "Suppress most JPG error messages when decode " |
| 55 "function fails."); | 55 "function fails."); |
| 56 | 56 |
| 57 ////////////////////////////////////////////////////////////////////////// | 57 ////////////////////////////////////////////////////////////////////////// |
| 58 ////////////////////////////////////////////////////////////////////////// | 58 ////////////////////////////////////////////////////////////////////////// |
| 59 | 59 |
| 60 static void overwrite_mem_buffer_size(jpeg_decompress_struct* cinfo) { | 60 static void overwrite_mem_buffer_size(jpeg_decompress_struct* cinfo) { |
| 61 #ifdef SK_BUILD_FOR_ANDROID | 61 #ifdef SK_BUILD_FOR_ANDROID |
| 62 /* Check if the device indicates that it has a large amount of system memory | 62 // We can use a large chunk of memory on all currently supported Android dev
ices |
| 63 * if so, increase the memory allocation to 30MB instead of the default 5MB. | |
| 64 */ | |
| 65 #ifdef ANDROID_LARGE_MEMORY_DEVICE | |
| 66 cinfo->mem->max_memory_to_use = 30 * 1024 * 1024; | 63 cinfo->mem->max_memory_to_use = 30 * 1024 * 1024; |
| 67 #else | |
| 68 cinfo->mem->max_memory_to_use = 5 * 1024 * 1024; | |
| 69 #endif | |
| 70 #endif // SK_BUILD_FOR_ANDROID | 64 #endif // SK_BUILD_FOR_ANDROID |
| 71 } | 65 } |
| 72 | 66 |
| 73 ////////////////////////////////////////////////////////////////////////// | 67 ////////////////////////////////////////////////////////////////////////// |
| 74 ////////////////////////////////////////////////////////////////////////// | 68 ////////////////////////////////////////////////////////////////////////// |
| 75 | 69 |
| 76 static void do_nothing_emit_message(jpeg_common_struct*, int) { | 70 static void do_nothing_emit_message(jpeg_common_struct*, int) { |
| 77 /* do nothing */ | 71 /* do nothing */ |
| 78 } | 72 } |
| 79 static void do_nothing_output_message(j_common_ptr) { | 73 static void do_nothing_output_message(j_common_ptr) { |
| (...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 return SkImageDecoder::kUnknown_Format; | 1460 return SkImageDecoder::kUnknown_Format; |
| 1467 } | 1461 } |
| 1468 | 1462 |
| 1469 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 1463 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { |
| 1470 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; | 1464 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; |
| 1471 } | 1465 } |
| 1472 | 1466 |
| 1473 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); | 1467 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); |
| 1474 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); | 1468 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); |
| 1475 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); | 1469 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); |
| OLD | NEW |