mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-23 14:42:29 +01:00
Optimized some of the previous changes related to order of evaluation.
This commit is contained in:
@@ -614,6 +614,8 @@ image2StandardPseudoColor(RContext *ctx, RImage *image)
|
|||||||
err = (short*)malloc(3*(image->width+2)*sizeof(short));
|
err = (short*)malloc(3*(image->width+2)*sizeof(short));
|
||||||
nerr = (short*)malloc(3*(image->width+2)*sizeof(short));
|
nerr = (short*)malloc(3*(image->width+2)*sizeof(short));
|
||||||
if (!err || !nerr) {
|
if (!err || !nerr) {
|
||||||
|
if (err)
|
||||||
|
free(err);
|
||||||
if (nerr)
|
if (nerr)
|
||||||
free(nerr);
|
free(nerr);
|
||||||
RErrorCode = RERR_NOMEMORY;
|
RErrorCode = RERR_NOMEMORY;
|
||||||
@@ -626,7 +628,6 @@ image2StandardPseudoColor(RContext *ctx, RImage *image)
|
|||||||
err[x++] = ptr[x1++];
|
err[x++] = ptr[x1++];
|
||||||
}
|
}
|
||||||
err[x] = err[x+1] = err[x+2] = 0;
|
err[x] = err[x+1] = err[x+2] = 0;
|
||||||
x += 3;
|
|
||||||
/* convert and dither the image to XImage */
|
/* convert and dither the image to XImage */
|
||||||
for (y=0, ofs=0; y<image->height; y++) {
|
for (y=0, ofs=0; y<image->height; y++) {
|
||||||
if (y<image->height-1) {
|
if (y<image->height-1) {
|
||||||
|
|||||||
@@ -185,9 +185,9 @@ RLoadJPEG(RContext *context, char *file_name, int index)
|
|||||||
jpeg_read_scanlines(&cinfo, buffer,(JDIMENSION) 1);
|
jpeg_read_scanlines(&cinfo, buffer,(JDIMENSION) 1);
|
||||||
bptr = buffer[0];
|
bptr = buffer[0];
|
||||||
for (i=0; i<cinfo.image_width; i++) {
|
for (i=0; i<cinfo.image_width; i++) {
|
||||||
*ptr = *(ptr+1) = *(ptr+2) = *bptr;
|
*ptr++ = *bptr;
|
||||||
bptr++;
|
*ptr++ = *bptr;
|
||||||
ptr += 3;
|
*ptr++ = *bptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user