// (e.g. Watcom C++, but not Open Watcom).
// This causes a conflict with jmorecfg.h header from libjpeg, so we have
// to make sure libjpeg won't try to define boolean itself. This is done by
// (e.g. Watcom C++, but not Open Watcom).
// This causes a conflict with jmorecfg.h header from libjpeg, so we have
// to make sure libjpeg won't try to define boolean itself. This is done by
src->pub.next_input_byte = src->buffer;
src->pub.bytes_in_buffer = src->stream->Read(src->buffer, JPEG_IO_BUFFER_SIZE).LastRead();
src->pub.next_input_byte = src->buffer;
src->pub.bytes_in_buffer = src->stream->Read(src->buffer, JPEG_IO_BUFFER_SIZE).LastRead();
if (src->pub.bytes_in_buffer > 0)
src->stream->SeekI(-(long)src->pub.bytes_in_buffer, wxFromCurrent);
if (src->pub.bytes_in_buffer > 0)
src->stream->SeekI(-(long)src->pub.bytes_in_buffer, wxFromCurrent);
- /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
- my_error_ptr myerr = (my_error_ptr) cinfo->err;
+ /* cinfo->err really points to a wx_error_mgr struct, so coerce pointer */
+ wx_error_ptr myerr = (wx_error_ptr) cinfo->err;
/* Always display the message. */
/* We could postpone this until after returning, if we chose. */
/* Always display the message. */
/* We could postpone this until after returning, if we chose. */
if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
src->buffer = new JOCTET[JPEG_IO_BUFFER_SIZE];
src->pub.next_input_byte = NULL; /* until buffer loaded */
src->stream = &infile;
src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
src->buffer = new JOCTET[JPEG_IO_BUFFER_SIZE];
src->pub.next_input_byte = NULL; /* until buffer loaded */
src->stream = &infile;
- src->pub.init_source = my_init_source;
- src->pub.fill_input_buffer = my_fill_input_buffer;
- src->pub.skip_input_data = my_skip_input_data;
+ src->pub.init_source = wx_init_source;
+ src->pub.fill_input_buffer = wx_fill_input_buffer;
+ src->pub.skip_input_data = wx_skip_input_data;
bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) )
{
struct jpeg_decompress_struct cinfo;
bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) )
{
struct jpeg_decompress_struct cinfo;
if (setjmp(jerr.setjmp_buffer)) {
/* If we get here, the JPEG code has signaled an error.
* We need to clean up the JPEG object, close the input file, and return.
if (setjmp(jerr.setjmp_buffer)) {
/* If we get here, the JPEG code has signaled an error.
* We need to clean up the JPEG object, close the input file, and return.
(cinfo.src->term_source)(&cinfo);
jpeg_destroy_decompress(&cinfo);
if (image->Ok()) image->Destroy();
(cinfo.src->term_source)(&cinfo);
jpeg_destroy_decompress(&cinfo);
if (image->Ok()) image->Destroy();
jpeg_read_header( &cinfo, TRUE );
cinfo.out_color_space = JCS_RGB;
jpeg_start_decompress( &cinfo );
jpeg_read_header( &cinfo, TRUE );
cinfo.out_color_space = JCS_RGB;
jpeg_start_decompress( &cinfo );
/* Allocate the output buffer --- it will be released when done with image */
dest->buffer = (JOCTET *)
/* Allocate the output buffer --- it will be released when done with image */
dest->buffer = (JOCTET *)
dest->stream->Write(dest->buffer, OUTPUT_BUF_SIZE);
dest->pub.next_output_byte = dest->buffer;
dest->stream->Write(dest->buffer, OUTPUT_BUF_SIZE);
dest->pub.next_output_byte = dest->buffer;
size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
/* Write any data remaining in the buffer */
if (datacount > 0)
dest->stream->Write(dest->buffer, datacount);
}
size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
/* Write any data remaining in the buffer */
if (datacount > 0)
dest->stream->Write(dest->buffer, datacount);
}
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
cinfo->dest = (struct jpeg_destination_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
cinfo->dest = (struct jpeg_destination_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- dest = (my_dest_ptr) cinfo->dest;
- dest->pub.init_destination = init_destination;
- dest->pub.empty_output_buffer = empty_output_buffer;
- dest->pub.term_destination = term_destination;
+ dest = (wx_dest_ptr) cinfo->dest;
+ dest->pub.init_destination = wx_init_destination;
+ dest->pub.empty_output_buffer = wx_empty_output_buffer;
+ dest->pub.term_destination = wx_term_destination;
dest->stream = &outfile;
}
bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
{
struct jpeg_compress_struct cinfo;
dest->stream = &outfile;
}
bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
{
struct jpeg_compress_struct cinfo;
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */
JSAMPLE *image_buffer;
int stride; /* physical row width in image buffer */
cinfo.err = jpeg_std_error(&jerr.pub);
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */
JSAMPLE *image_buffer;
int stride; /* physical row width in image buffer */
cinfo.err = jpeg_std_error(&jerr.pub);
if (setjmp(jerr.setjmp_buffer))
{
/* If we get here, the JPEG code has signaled an error.
if (setjmp(jerr.setjmp_buffer))
{
/* If we get here, the JPEG code has signaled an error.