Flutter Engine
The Flutter Engine
SkJpegDecoderMgr.h
Go to the documentation of this file.
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
16
17extern "C" {
18 #include "jpeglib.h" // NO_G3_REWRITE
19}
20
21#include <memory>
22
23class SkStream;
24
26public:
27
28 /*
29 * Print a useful error message and return false
30 */
31 bool returnFalse(const char caller[]);
32
33 /*
34 * Print a useful error message and return a decode failure
35 */
37
38 /*
39 * Create the decode manager
40 * Does not take ownership of stream
41 */
43
44 /*
45 * Initialize decompress struct
46 * Initialize the source manager
47 */
48 void init();
49
50 /*
51 * Returns true if it successfully sets outColor to the encoded color,
52 * and false otherwise.
53 */
55
56 /*
57 * Free memory used by the decode manager
58 */
60
61 /*
62 * Get the skjpeg_error_mgr in order to set an error return jmp_buf
63 */
64 skjpeg_error_mgr* errorMgr() { return &fErrorMgr; }
65
66 /*
67 * Get function for the decompress info struct
68 */
69 jpeg_decompress_struct* dinfo() { return &fDInfo; }
70
71 // Get the source manager.
73
74private:
75 // Wrapper that calls into the full SkJpegSourceMgr interface.
76 struct SourceMgr : jpeg_source_mgr {
77 static void InitSource(j_decompress_ptr dinfo);
78 static void SkipInputData(j_decompress_ptr dinfo, long num_bytes_long);
79 static boolean FillInputBuffer(j_decompress_ptr dinfo);
80 static void TermSource(j_decompress_ptr dinfo);
81
82 SourceMgr(std::unique_ptr<SkJpegSourceMgr> mgr);
83 std::unique_ptr<SkJpegSourceMgr> fSourceMgr;
84 };
85
86 jpeg_decompress_struct fDInfo;
87 SourceMgr fSrcMgr;
88 skjpeg_error_mgr fErrorMgr;
89 jpeg_progress_mgr fProgressMgr;
90 bool fInit;
91};
92
93#endif
SkJpegSourceMgr * getSourceMgr()
jpeg_decompress_struct * dinfo()
skjpeg_error_mgr * errorMgr()
JpegDecoderMgr(SkStream *stream)
SkCodec::Result returnFailure(const char caller[], SkCodec::Result result)
bool returnFalse(const char caller[])
bool getEncodedColor(SkEncodedInfo::Color *outColor)
Result
Definition: SkCodec.h:76
GAsyncResult * result