14#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
27 char buffer[JMSG_LENGTH_MAX];
40 int scan = ((j_decompress_ptr)
info)->input_scan_number;
64 switch (fDInfo.jpeg_color_space) {
72#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
73 SkAndroidFrameworkUtils::SafetyNetLog(
"118372692");
89 return fSrcMgr.fSourceMgr.get();
95 fDInfo.err = jpeg_std_error(&fErrorMgr);
100 jpeg_create_decompress(&fDInfo);
102 fDInfo.src = &fSrcMgr;
104 fDInfo.progress = &fProgressMgr;
110 jpeg_destroy_decompress(&fDInfo);
118void JpegDecoderMgr::SourceMgr::InitSource(j_decompress_ptr dinfo) {
119 JpegDecoderMgr::SourceMgr* src = (JpegDecoderMgr::SourceMgr*)dinfo->src;
120 src->fSourceMgr->initSource(src->next_input_byte, src->bytes_in_buffer);
124void JpegDecoderMgr::SourceMgr::SkipInputData(j_decompress_ptr dinfo,
long num_bytes_long) {
125 JpegDecoderMgr::SourceMgr*
src = (JpegDecoderMgr::SourceMgr*)dinfo->src;
126 size_t num_bytes =
static_cast<size_t>(num_bytes_long);
127 if (!
src->fSourceMgr->skipInputBytes(num_bytes,
src->next_input_byte,
src->bytes_in_buffer)) {
129 src->next_input_byte =
nullptr;
130 src->bytes_in_buffer = 0;
131 dinfo->err->error_exit((j_common_ptr)dinfo);
136boolean JpegDecoderMgr::SourceMgr::FillInputBuffer(j_decompress_ptr dinfo) {
137 JpegDecoderMgr::SourceMgr*
src = (JpegDecoderMgr::SourceMgr*)dinfo->src;
138 if (!
src->fSourceMgr->fillInputBuffer(
src->next_input_byte,
src->bytes_in_buffer)) {
140 src->next_input_byte =
nullptr;
141 src->bytes_in_buffer = 0;
148void JpegDecoderMgr::SourceMgr::TermSource(j_decompress_ptr dinfo) {}
150JpegDecoderMgr::SourceMgr::SourceMgr(std::unique_ptr<SkJpegSourceMgr> sourceMgr)
151 : fSourceMgr(
std::
move(sourceMgr)) {
152 init_source = JpegDecoderMgr::SourceMgr::InitSource;
153 fill_input_buffer = JpegDecoderMgr::SourceMgr::FillInputBuffer;
154 skip_input_data = JpegDecoderMgr::SourceMgr::SkipInputData;
155 resync_to_restart = jpeg_resync_to_restart;
156 term_source = JpegDecoderMgr::SourceMgr::TermSource;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SkCodecPrintf(...)
static void output_message(j_common_ptr info)
static void progress_monitor(j_common_ptr info)
static void print_message(const j_common_ptr info, const char caller[])
static std::unique_ptr< SkEncoder > Make(SkWStream *dst, const SkPixmap *src, const SkYUVAPixmaps *srcYUVA, const SkColorSpace *srcYUVAColorSpace, const SkJpegEncoder::Options &options)
void skjpeg_err_exit(j_common_ptr dinfo)
SkJpegSourceMgr * getSourceMgr()
JpegDecoderMgr(SkStream *stream)
SkCodec::Result returnFailure(const char caller[], SkCodec::Result result)
bool returnFalse(const char caller[])
bool getEncodedColor(SkEncodedInfo::Color *outColor)
static const uint8_t buffer[]