OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 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 #ifndef SkJpegUtility_DEFINED | 10 #ifndef SkJpegUtility_DEFINED |
(...skipping 16 matching lines...) Expand all Loading... |
27 jmp_buf fJmpBuf; | 27 jmp_buf fJmpBuf; |
28 }; | 28 }; |
29 | 29 |
30 | 30 |
31 void skjpeg_error_exit(j_common_ptr cinfo); | 31 void skjpeg_error_exit(j_common_ptr cinfo); |
32 | 32 |
33 /////////////////////////////////////////////////////////////////////////// | 33 /////////////////////////////////////////////////////////////////////////// |
34 /* Our source struct for directing jpeg to our stream object. | 34 /* Our source struct for directing jpeg to our stream object. |
35 */ | 35 */ |
36 struct skjpeg_source_mgr : jpeg_source_mgr { | 36 struct skjpeg_source_mgr : jpeg_source_mgr { |
37 skjpeg_source_mgr(SkStream* stream, SkImageDecoder* decoder, bool ownStream)
; | 37 skjpeg_source_mgr(SkStream* stream, SkImageDecoder* decoder); |
38 ~skjpeg_source_mgr(); | 38 ~skjpeg_source_mgr(); |
39 | 39 |
40 SkStream* fStream; | 40 // fStream is ref'ed and unref'ed |
41 void* fMemoryBase; | 41 SkStream* fStream; |
42 size_t fMemoryBaseSize; | 42 // Unowned pointer to the decoder, used to check if the decoding process |
43 bool fUnrefStream; | 43 // has been cancelled. |
44 SkImageDecoder* fDecoder; | 44 SkImageDecoder* fDecoder; |
45 enum { | 45 enum { |
46 kBufferSize = 1024 | 46 kBufferSize = 1024 |
47 }; | 47 }; |
48 char fBuffer[kBufferSize]; | 48 char fBuffer[kBufferSize]; |
49 }; | 49 }; |
50 | 50 |
51 ///////////////////////////////////////////////////////////////////////////// | 51 ///////////////////////////////////////////////////////////////////////////// |
52 /* Our destination struct for directing decompressed pixels to our stream | 52 /* Our destination struct for directing decompressed pixels to our stream |
53 * object. | 53 * object. |
54 */ | 54 */ |
55 struct skjpeg_destination_mgr : jpeg_destination_mgr { | 55 struct skjpeg_destination_mgr : jpeg_destination_mgr { |
56 skjpeg_destination_mgr(SkWStream* stream); | 56 skjpeg_destination_mgr(SkWStream* stream); |
57 | 57 |
58 SkWStream* fStream; | 58 SkWStream* fStream; |
59 | 59 |
60 enum { | 60 enum { |
61 kBufferSize = 1024 | 61 kBufferSize = 1024 |
62 }; | 62 }; |
63 uint8_t fBuffer[kBufferSize]; | 63 uint8_t fBuffer[kBufferSize]; |
64 }; | 64 }; |
65 | 65 |
66 #endif | 66 #endif |
OLD | NEW |