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 #include <stdio.h> |
| 17 extern "C" { |
| 18 #include "jpeglib.h" |
| 19 #include "jerror.h" |
| 20 } |
| 21 |
| 22 /* |
| 23 * Error handling struct |
| 24 */ |
| 25 struct skjpeg_error_mgr : jpeg_error_mgr { |
| 26 jmp_buf fJmpBuf; |
| 27 }; |
| 28 |
| 29 /* |
| 30 * Error handling function |
| 31 */ |
| 32 void skjpeg_err_exit(j_common_ptr cinfo); |
| 33 |
| 34 /* |
| 35 * Source handling struct for that allows libjpeg to use our stream object |
| 36 */ |
| 37 struct skjpeg_source_mgr : jpeg_source_mgr { |
| 38 skjpeg_source_mgr(SkStream* stream); |
| 39 |
| 40 SkStream* fStream; // unowned |
| 41 enum { |
| 42 // TODO (msarett): Experiment with different buffer sizes. |
| 43 // This size was chosen because it matches SkImageDecoder. |
| 44 kBufferSize = 1024 |
| 45 }; |
| 46 uint8_t* fBuffer; |
| 47 }; |
| 48 |
| 49 #endif |
OLD | NEW |