diff options
author | msarett <msarett@google.com> | 2015-04-15 07:32:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-15 07:32:20 -0700 |
commit | e16b04aa6041efb6507546547737e9603fa1606e (patch) | |
tree | 3bd78e41a9ff3df445c64d3c0429d83bb698570d /src/codec/SkJpegDecoderMgr.h | |
parent | f91e676f941c7e9ec91ac298eaa32e4bf8f52762 (diff) |
SkJpegCodec
Enables basic decoding for jpegs
Includes rewinding
565, YUV, and Jpeg encoding are not yet implemented
BUG=skia:3257
Review URL: https://codereview.chromium.org/1076923002
Diffstat (limited to 'src/codec/SkJpegDecoderMgr.h')
-rw-r--r-- | src/codec/SkJpegDecoderMgr.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/codec/SkJpegDecoderMgr.h b/src/codec/SkJpegDecoderMgr.h new file mode 100644 index 0000000000..444e693742 --- /dev/null +++ b/src/codec/SkJpegDecoderMgr.h @@ -0,0 +1,77 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkJpegDecoderMgr_DEFINED +#define SkJpegDecoderMgr_DEFINED + +#include "SkCodec.h" +#include "SkCodecPriv.h" +#include "SkJpegUtility.h" +#include "SkSwizzler.h" +#include "SkTemplates.h" + +// stdio is needed for jpeglib +#include <stdio.h> + +extern "C" { + #include "jpeglib.h" +} + +class JpegDecoderMgr : SkNoncopyable { +public: + + /* + * Print a useful error message and return false + */ + bool returnFalse(const char caller[]); + + /* + * Print a useful error message and return a decode failure + */ + SkCodec::Result returnFailure(const char caller[], SkCodec::Result result); + + /* + * Create the decode manager + * Does not take ownership of stream + */ + JpegDecoderMgr(SkStream* stream); + + /* + * Initialize decompress struct + * Initialize the source manager + */ + void init(); + + /* + * Recommend a color type based on the encoded format + */ + SkColorType getColorType(); + + /* + * Free memory used by the decode manager + */ + ~JpegDecoderMgr(); + + /* + * Get the jump buffer in order to set an error return point + */ + jmp_buf& getJmpBuf(); + + /* + * Get function for the decompress info struct + */ + jpeg_decompress_struct* dinfo(); + +private: + + jpeg_decompress_struct fDInfo; + skjpeg_source_mgr fSrcMgr; + skjpeg_error_mgr fErrorMgr; + bool fInit; +}; + +#endif |