+void jpeg_wxio_src( j_decompress_ptr cinfo, wxInputStream& infile )
+{
+ my_src_ptr src;
+
+ 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,
+ sizeof(my_source_mgr));
+ src = (my_src_ptr) cinfo->src;
+ }
+ src = (my_src_ptr) cinfo->src;
+ 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.resync_to_restart = jpeg_resync_to_restart; /* use default method */
+ src->pub.term_source = my_term_source;
+}
+