OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 #include "SkJpegDecoderMgr.h" | 8 #include "SkJpegDecoderMgr.h" |
9 #include "SkJpegUtility.h" | 9 #include "SkJpegUtility.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 } | 25 } |
26 static void output_message(j_common_ptr info) { | 26 static void output_message(j_common_ptr info) { |
27 print_message(info, "output_message"); | 27 print_message(info, "output_message"); |
28 } | 28 } |
29 | 29 |
30 /* | 30 /* |
31 * Choose the size of the memory buffer on Android | 31 * Choose the size of the memory buffer on Android |
32 */ | 32 */ |
33 static void overwrite_mem_buffer_size(jpeg_decompress_struct* dinfo) { | 33 static void overwrite_mem_buffer_size(jpeg_decompress_struct* dinfo) { |
34 #ifdef SK_BUILD_FOR_ANDROID | 34 #ifdef SK_BUILD_FOR_ANDROID |
35 | 35 // We can use a large chunk of memory on all currently supported Android dev ices |
36 // Use 30 MB for devices with a large amount of system memory and 5MB otherwise | |
37 // TODO: (msarett) This matches SkImageDecoder. Why were these values chosen? | |
38 #ifdef ANDROID_LARGE_MEMORY_DEVICE | |
39 dinfo->mem->max_memory_to_use = 30 * 1024 * 1024; | 36 dinfo->mem->max_memory_to_use = 30 * 1024 * 1024; |
scroggo
2015/04/27 20:05:58
Why do we use this value? I think I saw in your no
scroggo
2015/04/27 20:24:31
I think I've answered my own question: at least wh
| |
40 #else | |
41 dinfo->mem->max_memory_to_use = 5 * 1024 * 1024; | |
42 #endif | |
43 | |
44 #endif // SK_BUILD_FOR_ANDROID | 37 #endif // SK_BUILD_FOR_ANDROID |
45 } | 38 } |
46 | 39 |
47 bool JpegDecoderMgr::returnFalse(const char caller[]) { | 40 bool JpegDecoderMgr::returnFalse(const char caller[]) { |
48 print_message((j_common_ptr) &fDInfo, caller); | 41 print_message((j_common_ptr) &fDInfo, caller); |
49 return false; | 42 return false; |
50 } | 43 } |
51 | 44 |
52 SkCodec::Result JpegDecoderMgr::returnFailure(const char caller[], SkCodec::Resu lt result) { | 45 SkCodec::Result JpegDecoderMgr::returnFailure(const char caller[], SkCodec::Resu lt result) { |
53 print_message((j_common_ptr) &fDInfo, caller); | 46 print_message((j_common_ptr) &fDInfo, caller); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 } | 93 } |
101 } | 94 } |
102 | 95 |
103 jmp_buf& JpegDecoderMgr::getJmpBuf() { | 96 jmp_buf& JpegDecoderMgr::getJmpBuf() { |
104 return fErrorMgr.fJmpBuf; | 97 return fErrorMgr.fJmpBuf; |
105 } | 98 } |
106 | 99 |
107 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { | 100 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { |
108 return &fDInfo; | 101 return &fDInfo; |
109 } | 102 } |
OLD | NEW |