- for (y=0;y<cinfo.output_height;y++)
- { jpeg_read_scanlines(&cinfo,&js,1);
- swf_SetJPEGBitsLines(out,(U8**)&js,1);
+ if(cinfo.out_color_space == JCS_GRAYSCALE) {
+ /* happens only if JPEG_LIB_VERSION above
+ was too small - let's do the conversion ourselves */
+ for (y=0;y<cinfo.output_height;y++)
+ { int x;
+ jpeg_read_scanlines(&cinfo,&js,1);
+ for(x=cinfo.output_width-1;x>=0;x--) {
+ js[x*3] = js[x*3+1] = js[x*3+2] = js[x];
+ }
+ swf_SetJPEGBitsLines(out,(U8**)&js,1);
+ }
+ }
+ else {
+ for (y=0;y<cinfo.output_height;y++)
+ { jpeg_read_scanlines(&cinfo,&js,1);
+ swf_SetJPEGBitsLines(out,(U8**)&js,1);
+ }