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 #ifndef SkJpegDecoderMgr_DEFINED |
| 9 #define SkJpegDecoderMgr_DEFINED |
| 10 |
| 11 #include "SkCodec.h" |
| 12 #include "SkCodecPriv.h" |
| 13 #include "SkJpegUtility.h" |
| 14 #include "SkSwizzler.h" |
| 15 #include "SkTemplates.h" |
| 16 |
| 17 // stdio is needed for jpeglib |
| 18 #include <stdio.h> |
| 19 |
| 20 extern "C" { |
| 21 #include "jpeglib.h" |
| 22 } |
| 23 |
| 24 class JpegDecoderMgr : SkNoncopyable { |
| 25 public: |
| 26 |
| 27 /* |
| 28 * Print a useful error message and return false |
| 29 */ |
| 30 bool returnFalse(const char caller[]); |
| 31 |
| 32 /* |
| 33 * Print a useful error message and return a decode failure |
| 34 */ |
| 35 SkCodec::Result returnFailure(const char caller[], SkCodec::Result result); |
| 36 |
| 37 /* |
| 38 * Create the decode manager |
| 39 * Does not take ownership of stream |
| 40 */ |
| 41 JpegDecoderMgr(SkStream* stream); |
| 42 |
| 43 /* |
| 44 * Initialize decompress struct |
| 45 * Initialize the source manager |
| 46 */ |
| 47 void init(); |
| 48 |
| 49 /* |
| 50 * Recommend a color type based on the encoded format |
| 51 */ |
| 52 SkColorType getColorType(); |
| 53 |
| 54 /* |
| 55 * Free memory used by the decode manager |
| 56 */ |
| 57 ~JpegDecoderMgr(); |
| 58 |
| 59 /* |
| 60 * Get the jump buffer in order to set an error return point |
| 61 */ |
| 62 jmp_buf& getJmpBuf(); |
| 63 |
| 64 /* |
| 65 * Get function for the decompress info struct |
| 66 */ |
| 67 jpeg_decompress_struct* dinfo(); |
| 68 |
| 69 private: |
| 70 |
| 71 jpeg_decompress_struct fDInfo; |
| 72 skjpeg_source_mgr fSrcMgr; |
| 73 skjpeg_error_mgr fErrorMgr; |
| 74 bool fInit; |
| 75 }; |
| 76 |
| 77 #endif |
OLD | NEW |