34 #include "loaders/SILLYJPGImageContext.h" 36 #ifndef SILLY_OPT_INLINE 38 #include "loaders/SILLYJPGImageContext.icpp" 49 void JPG_init_source(j_decompress_ptr cinfo)
54 boolean JPG_fill_input_buffer(j_decompress_ptr cinfo)
57 cinfo->src->next_input_byte = jpg->d_source->
getDataPtr();
58 cinfo->src->bytes_in_buffer = jpg->d_source->
getSize();
62 void JPG_skip_input_data(j_decompress_ptr cinfo,
long num_bytes)
66 cinfo->src->next_input_byte += (size_t)num_bytes;
67 cinfo->src->bytes_in_buffer -= (size_t)num_bytes;
71 void JPG_term_source(j_decompress_ptr cinfo)
76 void JPG_error_exit(j_common_ptr cinfo)
80 longjmp(jpg->setjmp_buffer, 1);
84 void JPG_emit_message(j_common_ptr cinfo,
int msg_level)
90 JPGImageContext::JPGImageContext()
93 src_mgr.bytes_in_buffer = 0;
94 src_mgr.next_input_byte = 0;
95 src_mgr.init_source = JPG_init_source;
96 src_mgr.fill_input_buffer = JPG_fill_input_buffer;
97 src_mgr.skip_input_data = JPG_skip_input_data;
98 src_mgr.resync_to_restart = jpeg_resync_to_restart;
99 src_mgr.term_source = JPG_term_source;
100 jpeg_create_decompress(&cinfo);
101 cinfo.src = &src_mgr;
102 cinfo.client_data =
this;
103 cinfo.err = jpeg_std_error(&d_error_mgr);
104 d_error_mgr.error_exit = JPG_error_exit;
109 JPGImageContext::~JPGImageContext()
111 jpeg_destroy_decompress(&cinfo);
115 void JPGImageContext::setImageSize()
117 setWidth(cinfo.output_width);
118 setHeight(cinfo.output_height);
virtual const byte * getDataPtr() const =0
Get raw access to the image data.
Simple Image Loading LibrarY namespace.
virtual size_t getSize() const =0
Return the size of the data.
Store the data needed by an ImageLoader object during the parsing of an image.
Image Context for JPG image loader.