OLD | NEW |
| (Empty) |
1 | |
2 /* | |
3 * Copyright 2010 The Android Open Source Project | |
4 * | |
5 * Use of this source code is governed by a BSD-style license that can be | |
6 * found in the LICENSE file. | |
7 */ | |
8 | |
9 | |
10 #ifndef SkJpegUtility_DEFINED | |
11 #define SkJpegUtility_DEFINED | |
12 | |
13 #include "SkImageDecoder.h" | |
14 #include "SkStream.h" | |
15 | |
16 extern "C" { | |
17 #include "jpeglib.h" | |
18 #include "jerror.h" | |
19 } | |
20 | |
21 #include <setjmp.h> | |
22 | |
23 /* Our error-handling struct. | |
24 * | |
25 */ | |
26 struct skjpeg_error_mgr : jpeg_error_mgr { | |
27 jmp_buf fJmpBuf; | |
28 }; | |
29 | |
30 | |
31 void skjpeg_error_exit(j_common_ptr cinfo); | |
32 | |
33 /////////////////////////////////////////////////////////////////////////// | |
34 /* Our source struct for directing jpeg to our stream object. | |
35 */ | |
36 struct skjpeg_source_mgr : jpeg_source_mgr { | |
37 skjpeg_source_mgr(SkStream* stream, SkImageDecoder* decoder, bool ownStream)
; | |
38 ~skjpeg_source_mgr(); | |
39 | |
40 SkStream* fStream; | |
41 void* fMemoryBase; | |
42 size_t fMemoryBaseSize; | |
43 bool fUnrefStream; | |
44 SkImageDecoder* fDecoder; | |
45 enum { | |
46 kBufferSize = 1024 | |
47 }; | |
48 char fBuffer[kBufferSize]; | |
49 }; | |
50 | |
51 ///////////////////////////////////////////////////////////////////////////// | |
52 /* Our destination struct for directing decompressed pixels to our stream | |
53 * object. | |
54 */ | |
55 struct skjpeg_destination_mgr : jpeg_destination_mgr { | |
56 skjpeg_destination_mgr(SkWStream* stream); | |
57 | |
58 SkWStream* fStream; | |
59 | |
60 enum { | |
61 kBufferSize = 1024 | |
62 }; | |
63 uint8_t fBuffer[kBufferSize]; | |
64 }; | |
65 | |
66 #endif | |
OLD | NEW |