Image: Codestyle changes

This commit is contained in:
Peter Keresztes Schmidt 2021-09-12 11:38:44 +02:00 committed by Isaac Connor
parent 93c5ad0939
commit a4ebf533a9
1 changed files with 151 additions and 153 deletions

View File

@ -936,7 +936,7 @@ bool Image::WriteRaw(const char *filename) const {
bool Image::ReadJpeg(const std::string &filename, unsigned int p_colours, unsigned int p_subpixelorder) {
unsigned int new_width, new_height, new_colours, new_subpixelorder;
if ( !readjpg_dcinfo ) {
if (!readjpg_dcinfo) {
readjpg_dcinfo = new jpeg_decompress_struct;
readjpg_dcinfo->err = jpeg_std_error(&jpg_err.pub);
jpg_err.pub.error_exit = zm_jpeg_error_exit;
@ -945,12 +945,12 @@ bool Image::ReadJpeg(const std::string &filename, unsigned int p_colours, unsign
}
FILE *infile;
if ( (infile = fopen(filename.c_str(), "rb")) == nullptr ) {
if ((infile = fopen(filename.c_str(), "rb")) == nullptr) {
Error("Can't open %s: %s", filename.c_str(), strerror(errno));
return false;
}
if ( setjmp(jpg_err.setjmp_buffer) ) {
if (setjmp(jpg_err.setjmp_buffer)) {
jpeg_abort_decompress(readjpg_dcinfo);
fclose(infile);
return false;
@ -958,9 +958,9 @@ bool Image::ReadJpeg(const std::string &filename, unsigned int p_colours, unsign
jpeg_stdio_src(readjpg_dcinfo, infile);
jpeg_read_header(readjpg_dcinfo, TRUE);
jpeg_read_header(readjpg_dcinfo, true);
if ( (readjpg_dcinfo->num_components != 1) && (readjpg_dcinfo->num_components != 3) ) {
if ((readjpg_dcinfo->num_components != 1) && (readjpg_dcinfo->num_components != 3)) {
Error("Unexpected colours when reading jpeg image: %d", colours);
jpeg_abort_decompress(readjpg_dcinfo);
fclose(infile);
@ -969,72 +969,72 @@ bool Image::ReadJpeg(const std::string &filename, unsigned int p_colours, unsign
/* Check if the image has at least one huffman table defined. If not, use the standard ones */
/* This is required for the MJPEG capture palette of USB devices */
if ( readjpg_dcinfo->dc_huff_tbl_ptrs[0] == nullptr ) {
if (readjpg_dcinfo->dc_huff_tbl_ptrs[0] == nullptr) {
zm_use_std_huff_tables(readjpg_dcinfo);
}
new_width = readjpg_dcinfo->image_width;
new_height = readjpg_dcinfo->image_height;
if ( (width != new_width) || (height != new_height) ) {
if ((width != new_width) || (height != new_height)) {
Debug(9, "Image dimensions differ. Old: %ux%u New: %ux%u", width, height, new_width, new_height);
}
switch ( p_colours ) {
switch (p_colours) {
case ZM_COLOUR_GRAY8:
readjpg_dcinfo->out_color_space = JCS_GRAYSCALE;
new_colours = ZM_COLOUR_GRAY8;
new_subpixelorder = ZM_SUBPIX_ORDER_NONE;
break;
readjpg_dcinfo->out_color_space = JCS_GRAYSCALE;
new_colours = ZM_COLOUR_GRAY8;
new_subpixelorder = ZM_SUBPIX_ORDER_NONE;
break;
case ZM_COLOUR_RGB32:
#ifdef JCS_EXTENSIONS
new_colours = ZM_COLOUR_RGB32;
if ( p_subpixelorder == ZM_SUBPIX_ORDER_BGRA ) {
readjpg_dcinfo->out_color_space = JCS_EXT_BGRX;
new_subpixelorder = ZM_SUBPIX_ORDER_BGRA;
} else if ( p_subpixelorder == ZM_SUBPIX_ORDER_ARGB ) {
readjpg_dcinfo->out_color_space = JCS_EXT_XRGB;
new_subpixelorder = ZM_SUBPIX_ORDER_ARGB;
} else if ( p_subpixelorder == ZM_SUBPIX_ORDER_ABGR ) {
readjpg_dcinfo->out_color_space = JCS_EXT_XBGR;
new_subpixelorder = ZM_SUBPIX_ORDER_ABGR;
} else {
/* Assume RGBA */
readjpg_dcinfo->out_color_space = JCS_EXT_RGBX;
new_subpixelorder = ZM_SUBPIX_ORDER_RGBA;
}
break;
new_colours = ZM_COLOUR_RGB32;
if (p_subpixelorder == ZM_SUBPIX_ORDER_BGRA) {
readjpg_dcinfo->out_color_space = JCS_EXT_BGRX;
new_subpixelorder = ZM_SUBPIX_ORDER_BGRA;
} else if (p_subpixelorder == ZM_SUBPIX_ORDER_ARGB) {
readjpg_dcinfo->out_color_space = JCS_EXT_XRGB;
new_subpixelorder = ZM_SUBPIX_ORDER_ARGB;
} else if (p_subpixelorder == ZM_SUBPIX_ORDER_ABGR) {
readjpg_dcinfo->out_color_space = JCS_EXT_XBGR;
new_subpixelorder = ZM_SUBPIX_ORDER_ABGR;
} else {
/* Assume RGBA */
readjpg_dcinfo->out_color_space = JCS_EXT_RGBX;
new_subpixelorder = ZM_SUBPIX_ORDER_RGBA;
}
break;
#else
Warning("libjpeg-turbo is required for reading a JPEG directly into a RGB32 buffer, reading into a RGB24 buffer instead.");
Warning("libjpeg-turbo is required for reading a JPEG directly into a RGB32 buffer, reading into a RGB24 buffer instead.");
#endif
case ZM_COLOUR_RGB24:
default:
new_colours = ZM_COLOUR_RGB24;
if ( p_subpixelorder == ZM_SUBPIX_ORDER_BGR ) {
new_colours = ZM_COLOUR_RGB24;
if (p_subpixelorder == ZM_SUBPIX_ORDER_BGR) {
#ifdef JCS_EXTENSIONS
readjpg_dcinfo->out_color_space = JCS_EXT_BGR;
new_subpixelorder = ZM_SUBPIX_ORDER_BGR;
readjpg_dcinfo->out_color_space = JCS_EXT_BGR;
new_subpixelorder = ZM_SUBPIX_ORDER_BGR;
#else
Warning("libjpeg-turbo is required for reading a JPEG directly into a BGR24 buffer, reading into a RGB24 buffer instead.");
cinfo->out_color_space = JCS_RGB;
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
Warning("libjpeg-turbo is required for reading a JPEG directly into a BGR24 buffer, reading into a RGB24 buffer instead.");
cinfo->out_color_space = JCS_RGB;
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
#endif
} else {
/* Assume RGB */
/*
} else {
/* Assume RGB */
/*
#ifdef JCS_EXTENSIONS
cinfo->out_color_space = JCS_EXT_RGB;
#else
cinfo->out_color_space = JCS_RGB;
#endif
*/
readjpg_dcinfo->out_color_space = JCS_RGB;
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
}
break;
*/
readjpg_dcinfo->out_color_space = JCS_RGB;
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
}
break;
} // end switch p_colours
if ( WriteBuffer(new_width, new_height, new_colours, new_subpixelorder) == nullptr ) {
if (WriteBuffer(new_width, new_height, new_colours, new_subpixelorder) == nullptr) {
Error("Failed requesting writeable buffer for reading JPEG image.");
jpeg_abort_decompress(readjpg_dcinfo);
fclose(infile);
@ -1044,13 +1044,12 @@ cinfo->out_color_space = JCS_RGB;
jpeg_start_decompress(readjpg_dcinfo);
JSAMPROW row_pointer = buffer;
while ( readjpg_dcinfo->output_scanline < readjpg_dcinfo->output_height ) {
while (readjpg_dcinfo->output_scanline < readjpg_dcinfo->output_height) {
jpeg_read_scanlines(readjpg_dcinfo, &row_pointer, 1);
row_pointer += linesize;
}
jpeg_finish_decompress(readjpg_dcinfo);
fclose(infile);
return true;
@ -1080,34 +1079,37 @@ bool Image::WriteJpeg(const std::string &filename,
const int &quality_override,
SystemTimePoint timestamp,
bool on_blocking_abort) const {
if ( config.colour_jpeg_files && (colours == ZM_COLOUR_GRAY8) ) {
if (config.colour_jpeg_files && (colours == ZM_COLOUR_GRAY8)) {
Image temp_image(*this);
temp_image.Colourise(ZM_COLOUR_RGB24, ZM_SUBPIX_ORDER_RGB);
return temp_image.WriteJpeg(filename, quality_override, timestamp, on_blocking_abort);
}
int quality = quality_override ? quality_override : config.jpeg_file_quality;
struct jpeg_compress_struct *cinfo = writejpg_ccinfo[quality];
jpeg_compress_struct *cinfo = writejpg_ccinfo[quality];
FILE *outfile = nullptr;
int raw_fd = 0;
if ( !cinfo ) {
if (!cinfo) {
cinfo = writejpg_ccinfo[quality] = new jpeg_compress_struct;
cinfo->err = jpeg_std_error(&jpg_err.pub);
jpeg_create_compress(cinfo);
}
if ( !on_blocking_abort ) {
if (!on_blocking_abort) {
jpg_err.pub.error_exit = zm_jpeg_error_exit;
jpg_err.pub.emit_message = zm_jpeg_emit_message;
} else {
jpg_err.pub.error_exit = zm_jpeg_error_silent;
jpg_err.pub.emit_message = zm_jpeg_emit_silence;
if ( setjmp(jpg_err.setjmp_buffer) ) {
if (setjmp(jpg_err.setjmp_buffer)) {
jpeg_abort_compress(cinfo);
Debug(1, "Aborted a write mid-stream and %s and %d", (outfile == nullptr) ? "closing file" : "file not opened", raw_fd);
if ( raw_fd )
Debug(1,
"Aborted a write mid-stream and %s and %d",
(outfile == nullptr) ? "closing file" : "file not opened",
raw_fd);
if (raw_fd)
close(raw_fd);
if ( outfile )
if (outfile)
fclose(outfile);
return false;
}
@ -1134,58 +1136,58 @@ bool Image::WriteJpeg(const std::string &filename,
cinfo->image_width = width; /* image width and height, in pixels */
cinfo->image_height = height;
switch ( colours ) {
switch (colours) {
case ZM_COLOUR_GRAY8:
cinfo->input_components = 1;
cinfo->in_color_space = JCS_GRAYSCALE;
break;
cinfo->input_components = 1;
cinfo->in_color_space = JCS_GRAYSCALE;
break;
case ZM_COLOUR_RGB32:
#ifdef JCS_EXTENSIONS
cinfo->input_components = 4;
if ( subpixelorder == ZM_SUBPIX_ORDER_RGBA ) {
cinfo->in_color_space = JCS_EXT_RGBX;
} else if ( subpixelorder == ZM_SUBPIX_ORDER_BGRA ) {
cinfo->in_color_space = JCS_EXT_BGRX;
} else if ( subpixelorder == ZM_SUBPIX_ORDER_ARGB ) {
cinfo->in_color_space = JCS_EXT_XRGB;
} else if ( subpixelorder == ZM_SUBPIX_ORDER_ABGR ) {
cinfo->in_color_space = JCS_EXT_XBGR;
} else {
Warning("Unknwon subpixelorder %d", subpixelorder);
/* Assume RGBA */
cinfo->in_color_space = JCS_EXT_RGBX;
}
break;
cinfo->input_components = 4;
if (subpixelorder == ZM_SUBPIX_ORDER_RGBA) {
cinfo->in_color_space = JCS_EXT_RGBX;
} else if (subpixelorder == ZM_SUBPIX_ORDER_BGRA) {
cinfo->in_color_space = JCS_EXT_BGRX;
} else if (subpixelorder == ZM_SUBPIX_ORDER_ARGB) {
cinfo->in_color_space = JCS_EXT_XRGB;
} else if (subpixelorder == ZM_SUBPIX_ORDER_ABGR) {
cinfo->in_color_space = JCS_EXT_XBGR;
} else {
Warning("Unknwon subpixelorder %d", subpixelorder);
/* Assume RGBA */
cinfo->in_color_space = JCS_EXT_RGBX;
}
break;
#else
Error("libjpeg-turbo is required for JPEG encoding directly from RGB32 source");
Error("libjpeg-turbo is required for JPEG encoding directly from RGB32 source");
jpeg_abort_compress(cinfo);
fclose(outfile);
return false;
#endif
case ZM_COLOUR_RGB24:
default:
cinfo->input_components = 3;
if (subpixelorder == ZM_SUBPIX_ORDER_BGR) {
#ifdef JCS_EXTENSIONS
cinfo->in_color_space = JCS_EXT_BGR;
#else
Error("libjpeg-turbo is required for JPEG encoding directly from BGR24 source");
jpeg_abort_compress(cinfo);
fclose(outfile);
return false;
#endif
case ZM_COLOUR_RGB24:
default:
cinfo->input_components = 3;
if ( subpixelorder == ZM_SUBPIX_ORDER_BGR) {
#ifdef JCS_EXTENSIONS
cinfo->in_color_space = JCS_EXT_BGR;
#else
Error("libjpeg-turbo is required for JPEG encoding directly from BGR24 source");
jpeg_abort_compress(cinfo);
fclose(outfile);
return false;
#endif
} else {
/* Assume RGB */
/*
} else {
/* Assume RGB */
/*
#ifdef JCS_EXTENSIONS
cinfo->out_color_space = JCS_EXT_RGB;
#else
cinfo->out_color_space = JCS_RGB;
#endif
*/
cinfo->in_color_space = JCS_RGB;
}
break;
cinfo->in_color_space = JCS_RGB;
}
break;
} // end switch(colours)
jpeg_set_defaults(cinfo);
@ -1193,7 +1195,7 @@ cinfo->out_color_space = JCS_RGB;
cinfo->dct_method = JDCT_FASTEST;
jpeg_start_compress(cinfo, TRUE);
if ( config.add_jpeg_comments && !annotation_.empty() ) {
if (config.add_jpeg_comments && !annotation_.empty()) {
jpeg_write_marker(cinfo, JPEG_COM, reinterpret_cast<const JOCTET *>(annotation_.c_str()), annotation_.size());
}
// If we have a non-zero time (meaning a parameter was passed in), then form a simple exif segment with that time as DateTimeOriginal and SubsecTimeOriginal
@ -1217,19 +1219,19 @@ cinfo->out_color_space = JCS_RGB;
snprintf(msbuf, sizeof msbuf, "%06d", static_cast<int32>(ts_usec.count()));
unsigned char exiftimes[82] = {
0x45, 0x78, 0x69, 0x66, 0x00, 0x00, 0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00,
0x69, 0x87, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x03, 0x90, 0x02, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x91, 0x92,
0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x00 };
memcpy(&exiftimes[EXIFTIMES_OFFSET], timebuf,EXIFTIMES_LEN);
0x45, 0x78, 0x69, 0x66, 0x00, 0x00, 0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00,
0x69, 0x87, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x03, 0x90, 0x02, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x91, 0x92,
0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x00};
memcpy(&exiftimes[EXIFTIMES_OFFSET], timebuf, EXIFTIMES_LEN);
memcpy(&exiftimes[EXIFTIMES_MS_OFFSET], msbuf, EXIFTIMES_MS_LEN);
jpeg_write_marker(cinfo, EXIF_CODE, (const JOCTET *)exiftimes, sizeof(exiftimes));
jpeg_write_marker(cinfo, EXIF_CODE, (const JOCTET *) exiftimes, sizeof(exiftimes));
}
JSAMPROW row_pointer = buffer; /* pointer to a single row */
while ( cinfo->next_scanline < cinfo->image_height ) {
while (cinfo->next_scanline < cinfo->image_height) {
jpeg_write_scanlines(cinfo, &row_pointer, 1);
row_pointer += linesize;
}
@ -1239,23 +1241,19 @@ cinfo->out_color_space = JCS_RGB;
return true;
}
bool Image::DecodeJpeg(
const JOCTET *inbuffer,
int inbuffer_size,
unsigned int p_colours,
unsigned int p_subpixelorder)
bool Image::DecodeJpeg(const JOCTET *inbuffer, int inbuffer_size, unsigned int p_colours, unsigned int p_subpixelorder)
{
unsigned int new_width, new_height, new_colours, new_subpixelorder;
if ( !decodejpg_dcinfo ) {
if (!decodejpg_dcinfo) {
decodejpg_dcinfo = new jpeg_decompress_struct;
decodejpg_dcinfo->err = jpeg_std_error( &jpg_err.pub );
decodejpg_dcinfo->err = jpeg_std_error(&jpg_err.pub);
jpg_err.pub.error_exit = zm_jpeg_error_exit;
jpg_err.pub.emit_message = zm_jpeg_emit_message;
jpeg_create_decompress( decodejpg_dcinfo );
jpeg_create_decompress(decodejpg_dcinfo);
}
if ( setjmp(jpg_err.setjmp_buffer) ) {
if (setjmp(jpg_err.setjmp_buffer)) {
jpeg_abort_decompress(decodejpg_dcinfo);
return false;
}
@ -1264,7 +1262,7 @@ bool Image::DecodeJpeg(
jpeg_read_header(decodejpg_dcinfo, TRUE);
if ( (decodejpg_dcinfo->num_components != 1) && (decodejpg_dcinfo->num_components != 3) ) {
if ((decodejpg_dcinfo->num_components != 1) && (decodejpg_dcinfo->num_components != 3)) {
Error("Unexpected colours when reading jpeg image: %d", colours);
jpeg_abort_decompress(decodejpg_dcinfo);
return false;
@ -1272,73 +1270,73 @@ bool Image::DecodeJpeg(
/* Check if the image has at least one huffman table defined. If not, use the standard ones */
/* This is required for the MJPEG capture palette of USB devices */
if ( decodejpg_dcinfo->dc_huff_tbl_ptrs[0] == nullptr ) {
if (decodejpg_dcinfo->dc_huff_tbl_ptrs[0] == nullptr) {
zm_use_std_huff_tables(decodejpg_dcinfo);
}
new_width = decodejpg_dcinfo->image_width;
new_height = decodejpg_dcinfo->image_height;
if ( (width != new_width) || (height != new_height) ) {
if ((width != new_width) || (height != new_height)) {
Debug(9, "Image dimensions differ. Old: %ux%u New: %ux%u",
width, height, new_width, new_height);
width, height, new_width, new_height);
}
switch (p_colours) {
case ZM_COLOUR_GRAY8:
decodejpg_dcinfo->out_color_space = JCS_GRAYSCALE;
new_colours = ZM_COLOUR_GRAY8;
new_subpixelorder = ZM_SUBPIX_ORDER_NONE;
break;
new_colours = ZM_COLOUR_GRAY8;
new_subpixelorder = ZM_SUBPIX_ORDER_NONE;
break;
case ZM_COLOUR_RGB32:
#ifdef JCS_EXTENSIONS
new_colours = ZM_COLOUR_RGB32;
if ( p_subpixelorder == ZM_SUBPIX_ORDER_BGRA ) {
decodejpg_dcinfo->out_color_space = JCS_EXT_BGRX;
new_subpixelorder = ZM_SUBPIX_ORDER_BGRA;
} else if ( p_subpixelorder == ZM_SUBPIX_ORDER_ARGB ) {
decodejpg_dcinfo->out_color_space = JCS_EXT_XRGB;
new_subpixelorder = ZM_SUBPIX_ORDER_ARGB;
} else if ( p_subpixelorder == ZM_SUBPIX_ORDER_ABGR ) {
decodejpg_dcinfo->out_color_space = JCS_EXT_XBGR;
new_subpixelorder = ZM_SUBPIX_ORDER_ABGR;
} else {
/* Assume RGBA */
decodejpg_dcinfo->out_color_space = JCS_EXT_RGBX;
new_subpixelorder = ZM_SUBPIX_ORDER_RGBA;
}
break;
new_colours = ZM_COLOUR_RGB32;
if (p_subpixelorder == ZM_SUBPIX_ORDER_BGRA) {
decodejpg_dcinfo->out_color_space = JCS_EXT_BGRX;
new_subpixelorder = ZM_SUBPIX_ORDER_BGRA;
} else if (p_subpixelorder == ZM_SUBPIX_ORDER_ARGB) {
decodejpg_dcinfo->out_color_space = JCS_EXT_XRGB;
new_subpixelorder = ZM_SUBPIX_ORDER_ARGB;
} else if (p_subpixelorder == ZM_SUBPIX_ORDER_ABGR) {
decodejpg_dcinfo->out_color_space = JCS_EXT_XBGR;
new_subpixelorder = ZM_SUBPIX_ORDER_ABGR;
} else {
/* Assume RGBA */
decodejpg_dcinfo->out_color_space = JCS_EXT_RGBX;
new_subpixelorder = ZM_SUBPIX_ORDER_RGBA;
}
break;
#else
Warning("libjpeg-turbo is required for reading a JPEG directly into a RGB32 buffer, reading into a RGB24 buffer instead.");
Warning("libjpeg-turbo is required for reading a JPEG directly into a RGB32 buffer, reading into a RGB24 buffer instead.");
#endif
case ZM_COLOUR_RGB24:
default:
new_colours = ZM_COLOUR_RGB24;
if ( p_subpixelorder == ZM_SUBPIX_ORDER_BGR ) {
new_colours = ZM_COLOUR_RGB24;
if (p_subpixelorder == ZM_SUBPIX_ORDER_BGR) {
#ifdef JCS_EXTENSIONS
decodejpg_dcinfo->out_color_space = JCS_EXT_BGR;
new_subpixelorder = ZM_SUBPIX_ORDER_BGR;
decodejpg_dcinfo->out_color_space = JCS_EXT_BGR;
new_subpixelorder = ZM_SUBPIX_ORDER_BGR;
#else
Warning("libjpeg-turbo is required for reading a JPEG directly into a BGR24 buffer, reading into a RGB24 buffer instead.");
cinfo->out_color_space = JCS_RGB;
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
Warning("libjpeg-turbo is required for reading a JPEG directly into a BGR24 buffer, reading into a RGB24 buffer instead.");
cinfo->out_color_space = JCS_RGB;
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
#endif
} else {
/* Assume RGB */
/*
} else {
/* Assume RGB */
/*
#ifdef JCS_EXTENSIONS
cinfo->out_color_space = JCS_EXT_RGB;
#else
cinfo->out_color_space = JCS_RGB;
#endif
*/
decodejpg_dcinfo->out_color_space = JCS_RGB;
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
}
break;
*/
decodejpg_dcinfo->out_color_space = JCS_RGB;
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
}
break;
} // end switch
if ( WriteBuffer(new_width, new_height, new_colours, new_subpixelorder) == nullptr ) {
if (WriteBuffer(new_width, new_height, new_colours, new_subpixelorder) == nullptr) {
Error("Failed requesting writeable buffer for reading JPEG image.");
jpeg_abort_decompress(decodejpg_dcinfo);
return false;
@ -1347,7 +1345,7 @@ cinfo->out_color_space = JCS_RGB;
jpeg_start_decompress(decodejpg_dcinfo);
JSAMPROW row_pointer = buffer; /* pointer to a single row */
while ( decodejpg_dcinfo->output_scanline < decodejpg_dcinfo->output_height ) {
while (decodejpg_dcinfo->output_scanline < decodejpg_dcinfo->output_height) {
jpeg_read_scanlines(decodejpg_dcinfo, &row_pointer, 1);
row_pointer += linesize;
}