Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/images/SkImageDecoder_libjpeg.cpp

Issue 21561002: Fixes for JPEG subset decoding. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove reference to unused file from the gyp Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/images/SkBitmapRegionDecoder.cpp ('k') | src/images/SkJpegUtility.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #endif 58 #endif
59 #endif // SK_BUILD_FOR_ANDROID 59 #endif // SK_BUILD_FOR_ANDROID
60 } 60 }
61 61
62 ////////////////////////////////////////////////////////////////////////// 62 //////////////////////////////////////////////////////////////////////////
63 ////////////////////////////////////////////////////////////////////////// 63 //////////////////////////////////////////////////////////////////////////
64 64
65 class SkJPEGImageIndex { 65 class SkJPEGImageIndex {
66 public: 66 public:
67 SkJPEGImageIndex(SkStream* stream, SkImageDecoder* decoder) 67 SkJPEGImageIndex(SkStream* stream, SkImageDecoder* decoder)
68 : fSrcMgr(stream, decoder, true) {} 68 : fSrcMgr(stream, decoder) {}
69 69
70 ~SkJPEGImageIndex() { 70 ~SkJPEGImageIndex() {
71 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 71 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
72 jpeg_destroy_huffman_index(&fHuffmanIndex); 72 jpeg_destroy_huffman_index(&fHuffmanIndex);
73 #endif 73 #endif
74 jpeg_finish_decompress(&fCInfo); 74 jpeg_finish_decompress(&fCInfo);
75 jpeg_destroy_decompress(&fCInfo); 75 jpeg_destroy_decompress(&fCInfo);
76 } 76 }
77 77
78 /** 78 /**
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { 232 bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
233 #ifdef TIME_DECODE 233 #ifdef TIME_DECODE
234 SkAutoTime atm("JPEG Decode"); 234 SkAutoTime atm("JPEG Decode");
235 #endif 235 #endif
236 236
237 JPEGAutoClean autoClean; 237 JPEGAutoClean autoClean;
238 238
239 jpeg_decompress_struct cinfo; 239 jpeg_decompress_struct cinfo;
240 skjpeg_error_mgr errorManager; 240 skjpeg_error_mgr errorManager;
241 skjpeg_source_mgr srcManager(stream, this, false); 241 skjpeg_source_mgr srcManager(stream, this);
242 242
243 cinfo.err = jpeg_std_error(&errorManager); 243 cinfo.err = jpeg_std_error(&errorManager);
244 errorManager.error_exit = skjpeg_error_exit; 244 errorManager.error_exit = skjpeg_error_exit;
245 245
246 // All objects need to be instantiated before this setjmp call so that 246 // All objects need to be instantiated before this setjmp call so that
247 // they will be cleaned up properly if an error occurs. 247 // they will be cleaned up properly if an error occurs.
248 if (setjmp(errorManager.fJmpBuf)) { 248 if (setjmp(errorManager.fJmpBuf)) {
249 return return_false(cinfo, *bm, "setjmp"); 249 return return_false(cinfo, *bm, "setjmp");
250 } 250 }
251 251
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 } 1022 }
1023 1023
1024 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { 1024 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) {
1025 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; 1025 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL;
1026 } 1026 }
1027 1027
1028 1028
1029 static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(sk_libjpeg_dfactory); 1029 static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(sk_libjpeg_dfactory);
1030 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_jpeg ); 1030 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_jpeg );
1031 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_libjpeg_efact ory); 1031 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_libjpeg_efact ory);
OLDNEW
« no previous file with comments | « src/images/SkBitmapRegionDecoder.cpp ('k') | src/images/SkJpegUtility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698