Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
JpegDecoderMgr Class Reference

#include <SkJpegDecoderMgr.h>

Inheritance diagram for JpegDecoderMgr:
SkNoncopyable

Public Member Functions

bool returnFalse (const char caller[])
 
SkCodec::Result returnFailure (const char caller[], SkCodec::Result result)
 
 JpegDecoderMgr (SkStream *stream)
 
void init ()
 
bool getEncodedColor (SkEncodedInfo::Color *outColor)
 
 ~JpegDecoderMgr ()
 
skjpeg_error_mgrerrorMgr ()
 
jpeg_decompress_struct * dinfo ()
 
SkJpegSourceMgrgetSourceMgr ()
 

Detailed Description

Definition at line 25 of file SkJpegDecoderMgr.h.

Constructor & Destructor Documentation

◆ JpegDecoderMgr()

JpegDecoderMgr::JpegDecoderMgr ( SkStream stream)

Definition at line 92 of file SkJpegDecoderMgr.cpp.

93 : fSrcMgr(SkJpegSourceMgr::Make(stream)), fInit(false) {
94 // An error manager must be set before any calls to libjpeg, in order to handle failures.
95 fDInfo.err = jpeg_std_error(&fErrorMgr);
96 fErrorMgr.error_exit = skjpeg_err_exit;
97}
void skjpeg_err_exit(j_common_ptr dinfo)
static std::unique_ptr< SkJpegSourceMgr > Make(SkStream *stream, size_t bufferSize=1024)

◆ ~JpegDecoderMgr()

JpegDecoderMgr::~JpegDecoderMgr ( )

Definition at line 108 of file SkJpegDecoderMgr.cpp.

108 {
109 if (fInit) {
110 jpeg_destroy_decompress(&fDInfo);
111 }
112}

Member Function Documentation

◆ dinfo()

jpeg_decompress_struct * JpegDecoderMgr::dinfo ( )
inline

Definition at line 69 of file SkJpegDecoderMgr.h.

69{ return &fDInfo; }

◆ errorMgr()

skjpeg_error_mgr * JpegDecoderMgr::errorMgr ( )
inline

Definition at line 64 of file SkJpegDecoderMgr.h.

64{ return &fErrorMgr; }

◆ getEncodedColor()

bool JpegDecoderMgr::getEncodedColor ( SkEncodedInfo::Color outColor)

Definition at line 63 of file SkJpegDecoderMgr.cpp.

63 {
64 switch (fDInfo.jpeg_color_space) {
65 case JCS_GRAYSCALE:
67 return true;
68 case JCS_YCbCr:
69 *outColor = SkEncodedInfo::kYUV_Color;
70 return true;
71 case JCS_RGB:
72#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
73 SkAndroidFrameworkUtils::SafetyNetLog("118372692");
74#endif
75 *outColor = SkEncodedInfo::kRGB_Color;
76 return true;
77 case JCS_YCCK:
79 return true;
80 case JCS_CMYK:
82 return true;
83 default:
84 return false;
85 }
86}

◆ getSourceMgr()

SkJpegSourceMgr * JpegDecoderMgr::getSourceMgr ( )

Definition at line 88 of file SkJpegDecoderMgr.cpp.

88 {
89 return fSrcMgr.fSourceMgr.get();
90}

◆ init()

void JpegDecoderMgr::init ( )

Definition at line 99 of file SkJpegDecoderMgr.cpp.

99 {
100 jpeg_create_decompress(&fDInfo);
101 fInit = true;
102 fDInfo.src = &fSrcMgr;
103 fDInfo.err->output_message = &output_message;
104 fDInfo.progress = &fProgressMgr;
105 fProgressMgr.progress_monitor = &progress_monitor;
106}
static void output_message(j_common_ptr info)
static void progress_monitor(j_common_ptr info)

◆ returnFailure()

SkCodec::Result JpegDecoderMgr::returnFailure ( const char  caller[],
SkCodec::Result  result 
)

Definition at line 58 of file SkJpegDecoderMgr.cpp.

58 {
59 print_message((j_common_ptr) &fDInfo, caller);
60 return result;
61}
static void print_message(const j_common_ptr info, const char caller[])
GAsyncResult * result

◆ returnFalse()

bool JpegDecoderMgr::returnFalse ( const char  caller[])

Definition at line 53 of file SkJpegDecoderMgr.cpp.

53 {
54 print_message((j_common_ptr) &fDInfo, caller);
55 return false;
56}

The documentation for this class was generated from the following files: