Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 127008 | Differences between
and this patch

Collapse All | Expand All

(-)xzgv-0.8-patched/src/readjpeg.c (-6 / +38 lines)
Lines 179-189 Link Here
179
static int have_image;
179
static int have_image;
180
static int width,height;
180
static int width,height;
181
static unsigned char *image;
181
static unsigned char *image;
182
static int cmyk;
182
unsigned char *ptr,*ptr2;
183
unsigned char *ptr,*ptr2;
183
int chkw,chkh;
184
int chkw,chkh;
184
int f,rec;
185
int f,rec;
185
static int greyscale;	/* static to satisfy gcc -Wall */
186
static int greyscale;	/* static to satisfy gcc -Wall */
186
187
188
cmyk=0;
187
greyscale=0;
189
greyscale=0;
188
190
189
lineptrs=NULL;
191
lineptrs=NULL;
Lines 225-230 Link Here
225
  greyscale=1;
227
  greyscale=1;
226
  }
228
  }
227
229
230
if(cinfo.jpeg_color_space==JCS_CMYK)
231
  cmyk=1;
232
233
if(cinfo.jpeg_color_space==JCS_YCCK)
234
  {
235
  cmyk=1;
236
  cinfo.out_color_space=JCS_CMYK;
237
  }
238
228
*wp=width=cinfo.image_width;
239
*wp=width=cinfo.image_width;
229
*hp=height=cinfo.image_height;
240
*hp=height=cinfo.image_height;
230
241
Lines 266-272 Link Here
266
/* this one shouldn't hurt */
277
/* this one shouldn't hurt */
267
cinfo.do_block_smoothing=FALSE;
278
cinfo.do_block_smoothing=FALSE;
268
279
269
if(WH_BAD(width,height) || (*imagep=image=malloc(width*height*3))==NULL)
280
if(WH_BAD(width,height) || (*imagep=image=malloc(width*(height+cmyk)*3))==NULL)
270
  longjmp(jerr.setjmp_buffer,1);
281
  longjmp(jerr.setjmp_buffer,1);
271
282
272
jpeg_start_decompress(&cinfo);
283
jpeg_start_decompress(&cinfo);
Lines 279-290 Link Here
279
for(f=0;f<height;f++,ptr+=width*3)
290
for(f=0;f<height;f++,ptr+=width*3)
280
  lineptrs[f]=ptr;
291
  lineptrs[f]=ptr;
281
292
282
rec=cinfo.rec_outbuf_height;
293
if(!cmyk)
283
while(cinfo.output_scanline<height)
284
  {
294
  {
285
  f=height-cinfo.output_scanline;
295
  rec=cinfo.rec_outbuf_height;
286
  jpeg_read_scanlines(&cinfo,lineptrs+cinfo.output_scanline,
296
  while(cinfo.output_scanline<height)
287
                      f>rec?rec:f);
297
    {
298
    f=height-cinfo.output_scanline;
299
    jpeg_read_scanlines(&cinfo,lineptrs+cinfo.output_scanline,
300
                        f>rec?rec:f);
301
    }
302
  }
303
else	/* cmyk output */
304
  {
305
  int tmp;
306
307
  ptr=image;
308
  while(cinfo.output_scanline<height)
309
    {
310
    jpeg_read_scanlines(&cinfo,&ptr,1);
311
    ptr2=ptr;
312
    for(f=0;f<width;f++,ptr+=3,ptr2+=4)
313
      {
314
      tmp=ptr2[3];
315
      ptr[0]=(tmp*ptr2[0])/255;
316
      ptr[1]=(tmp*ptr2[1])/255;
317
      ptr[2]=(tmp*ptr2[2])/255;
318
      }
319
    }
288
  }
320
  }
289
321
290
free(lineptrs);
322
free(lineptrs);

Return to bug 127008