OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2015 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 | |
9 #ifndef SkJpegUtility_DEFINED | |
10 #define SkJpegUtility_DEFINED | |
11 | |
12 #include "SkImageDecoder.h" | |
13 #include "SkStream.h" | |
14 | |
15 #include <setjmp.h> | |
16 // stdio is needed for jpeglib | |
17 #include <stdio.h> | |
18 #include "jpeglib.h" | |
19 #include "jerror.h" | |
20 | |
21 /* | |
22 * Error handling struct | |
23 */ | |
24 struct skjpeg_error_mgr : jpeg_error_mgr { | |
25 jmp_buf fJmpBuf; | |
26 }; | |
27 | |
28 /* | |
29 * Error handling function | |
30 */ | |
31 void skjpeg_err_exit(j_common_ptr cinfo); | |
32 | |
33 /* | |
34 * Source handling struct for that allows libjpeg to use our stream object | |
35 */ | |
36 struct skjpeg_source_mgr : jpeg_source_mgr { | |
37 skjpeg_source_mgr(SkStream* stream); | |
38 | |
39 SkStream* fStream; // unowned | |
40 enum { | |
41 // TODO (msarett): Experiment with different buffer sizes. | |
42 // This size was chosen because it matches SkImageDecoder. | |
43 kBufferSize = 1024 | |
44 }; | |
45 SkAutoTDeleteArray<uint8_t> fBuffer; | |
scroggo
2015/04/14 13:10:33
This can just be:
uint8_t fBuffer[kBufferSize];
msarett
2015/04/14 19:30:36
You are right. I have had several misunderstandin
| |
46 }; | |
47 | |
48 #endif | |
OLD | NEW |