40 template<
class Convert>
41 void claw::graphic::jpeg::reader::read_data
42 ( jpeg_decompress_struct& cinfo,
const Convert& pixel_convert )
44 const unsigned int pixel_size = cinfo.output_components;
45 JSAMPLE* buffer =
new JSAMPLE[cinfo.output_width * pixel_size];
48 jpeg_error_mgr* jerr_saved = cinfo.err;
50 cinfo.err = jpeg_std_error(&jerr.pub);
53 if ( setjmp(jerr.setjmp_buffer) )
59 while (cinfo.output_scanline < cinfo.output_height)
61 jpeg_read_scanlines(&cinfo, &buffer, 1);
65 for (
unsigned int i=0; i!=pixel_size*m_image.
width();
66 i+=pixel_size, ++pixel )
67 *pixel = pixel_convert( &buffer[i] );
71 cinfo.err = jerr_saved;
unsigned int width() const
Gets image's width.
void jpeg__error_manager__error_exit(j_common_ptr cinfo)
Throw an exception when an error occurs in an internal jpeg processing.
super::iterator iterator
Iterator in the line.
A simple class to use as exception with string message.
iterator begin()
Get an iterator pointing on the first pixel.
Methods for the claw::graphic::jpeg::error_manager class.
#define CLAW_EXCEPTION(m)
Create an exception and add the name of the current function to the message.