mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-02 22:25:48 +01:00
This update includes the 0.20.3pre3 code
This commit is contained in:
@@ -613,7 +613,7 @@ RConvertImage(RContext *context, RImage *image, Pixmap *pixmap)
|
||||
image->height, context->depth);
|
||||
|
||||
#ifdef XSHM
|
||||
if (context->flags.use_shared_pixmap)
|
||||
if (context->flags.use_shared_pixmap && ximg->is_shared)
|
||||
tmp = R_CreateXImageMappedPixmap(context, ximg);
|
||||
else
|
||||
tmp = None;
|
||||
|
||||
29
wrlib/jpeg.c
29
wrlib/jpeg.c
@@ -143,26 +143,39 @@ RLoadJPEG(RContext *context, char *file_name, int index)
|
||||
goto bye;
|
||||
}
|
||||
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
|
||||
if(cinfo.jpeg_color_space==JCS_GRAYSCALE) {
|
||||
cinfo.out_color_space=JCS_GRAYSCALE;
|
||||
} else
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
cinfo.quantize_colors = FALSE;
|
||||
cinfo.do_fancy_upsampling = FALSE;
|
||||
cinfo.do_block_smoothing = FALSE;
|
||||
|
||||
jpeg_calc_output_dimensions(&cinfo);
|
||||
image = RCreateImage(cinfo.image_width, cinfo.image_height, False);
|
||||
if (!image) {
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
goto bye;
|
||||
}
|
||||
jpeg_start_decompress(&cinfo);
|
||||
|
||||
r = image->data[0];
|
||||
g = image->data[1];
|
||||
b = image->data[2];
|
||||
|
||||
while (cinfo.output_scanline < cinfo.image_height) {
|
||||
jpeg_read_scanlines(&cinfo, buffer, 1);
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
jpeg_read_scanlines(&cinfo, buffer,(JDIMENSION) 1);
|
||||
for (i=0,j=0; i<cinfo.image_width; i++) {
|
||||
*(r++) = buffer[0][j++];
|
||||
*(g++) = buffer[0][j++];
|
||||
*(b++) = buffer[0][j++];
|
||||
if(cinfo.out_color_space==JCS_RGB) {
|
||||
*(r++) = buffer[0][j++];
|
||||
*(g++) = buffer[0][j++];
|
||||
*(b++) = buffer[0][j++];}
|
||||
else {
|
||||
*(r++) = *(g++) = *(b++) = buffer[0][j++];
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
*/
|
||||
bye:
|
||||
|
||||
@@ -101,7 +101,6 @@ void main(int argc, char **argv)
|
||||
puts("cant open display");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
attr.flags = RC_RenderMode | RC_ColorsPerChannel;
|
||||
|
||||
attr.render_mode = rmode;
|
||||
|
||||
@@ -89,6 +89,8 @@ RCreateXImage(RContext *context, int depth, unsigned width, unsigned height)
|
||||
#else /* XSHM */
|
||||
if (!context->attribs->use_shared_memory) {
|
||||
retry_without_shm:
|
||||
|
||||
context->attribs->use_shared_memory = 0;
|
||||
rximg->is_shared = 0;
|
||||
rximg->image = XCreateImage(context->dpy, visual, depth,
|
||||
ZPixmap, 0, NULL, width, height, 8, 0);
|
||||
@@ -115,7 +117,7 @@ RCreateXImage(RContext *context, int depth, unsigned width, unsigned height)
|
||||
|
||||
rximg->info.shmid = shmget(IPC_PRIVATE,
|
||||
rximg->image->bytes_per_line*height,
|
||||
IPC_CREAT|0666);
|
||||
IPC_CREAT|0777);
|
||||
if (rximg->info.shmid < 0) {
|
||||
context->attribs->use_shared_memory = 0;
|
||||
perror("wrlib:could not allocate shared memory segment");
|
||||
@@ -150,7 +152,8 @@ RCreateXImage(RContext *context, int depth, unsigned width, unsigned height)
|
||||
perror("wrlib:shmdt");
|
||||
if (shmctl(rximg->info.shmid, IPC_RMID, 0) < 0)
|
||||
perror("wrlib:shmctl");
|
||||
printf("wrlib:error attaching shared memory segment to XImage\n");
|
||||
/* printf("wrlib:error attaching shared memory segment to XImage\n");
|
||||
*/
|
||||
goto retry_without_shm;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user