[Gtkradiant] [Bug 900] New: image plugin puts garbage in alpha component of .jpg files

gtkradiant@zerowing.idsoftware.com gtkradiant@zerowing.idsoftware.com
Tue, 21 Oct 2003 19:09:57 -0500


http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=900

           Summary: image plugin puts garbage in alpha component of .jpg
                    files
           Product: GtkRadiant
           Version: 1.3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: editor
        AssignedTo: ttimo@idsoftware.com
        ReportedBy: rfm@collectivecomputing.com


in 
plugins/image/jpeg.cpp line 380
we have this
    if (cinfo.out_color_components == 4)
      j_putRGBAScanline (buffer[0], cinfo.output_width, *pic,
cinfo.output_scanline-1);
		else if (cinfo.out_color_components == 3)
      j_putRGBScanline (buffer[0], cinfo.output_width, *pic,
cinfo.output_scanline-1);
    else if (cinfo.out_color_components == 1)
      j_putGrayScanlineToRGB (buffer[0], cinfo.output_width, *pic,
cinfo.output_scanline-1);

j_putRGBScanline sets the 4th component to 255, but with a normal 3 component
.jpg it never gets called, because the jpeg lib bases out_color_components on
RGB_PIXELSIZE from libs/jpeg6/jmorecfg.h

See libs/jpeg6/jmaster.cpp line 179.

Building with RGB_PIXELSIZE 3 seems corrects the problem, and the resulting
radiant seems to work OK. Not sure what else it might impact.

You can see the results of this bug if you put qer_trans on a shader whose
qer_editorimage is a .jpg