[sane-devel] Patches for SANE 1.0.9 be/fe compiled on IRIX
Andrea Suatoni
a.suatoni at telefonica.net
Tue Jan 14 21:08:02 GMT 2003
Henning Meier-Geinitz wrote:
> > Using the SGI X server in 24 bit (SGI boxes are big endian), the red and blue
> > channels are swapped without the change. You may enclose the changes I've
> > applied using #ifdef __sgi (this will be valid only on SGI machines, using
> > either GCC or the SGI compiler).
>
> Ok, but I'd rather try to understand what's up here. Basically, you
> are chnaging the rules for the order of colors in memory with your
> patch. While it was rgb for big-endian and bgr for little-endian your
> patch swaps it to make it the other way round.
It's not always like the way you describe. In fact, my SGI O2 is currently
running the following visual (among the 29 supported):
screen #0:
dimensions: 1280x1024 pixels (350x280 millimeters)
resolution: 93x93 dots per inch
depths (5): 1, 8, 12, 15, 24
root window id: 0x40
depth of root window: 24 planes
number of colormaps: minimum 1, maximum 11
default colormap: 0x3d
default number of colormap cells: 256
preallocated pixels: black 0, white 16777215
options: backing-store NO, save-unders NO
largest cursor: 32x32
current input event mask: 0x72003c
ButtonPressMask ButtonReleaseMask EnterWindowMask
LeaveWindowMask StructureNotifyMask SubstructureRedirectMask
FocusChangeMask PropertyChangeMask
number of visuals: 29
default visual id: 0x32
<snip>
visual:
visual id: 0x32
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff, 0xff00, 0xff0000
significant bits in color specification: 8 bits
Of course, you have also the following, but it's not the default one when
running the X server in TrueColor:
visual:
visual id: 0x33
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
Other SGI boxes may vary, depending on the XDM settings chosen by the sys
admin, and on the type of graphic subsystem installed.
On IRIX, all the visuals are usable at the same time. It may be possible,
eventually, to choose a visual (PseudoColor or TrueColor) with matches also
the RGB mask (instead of the default BGR mask). The old Maelstrom X11 porting,
for example, did exactly this.
> So it looks like (at least on your system) the color order is bgr
> despite it's big-endian. Could you test all the cases (24/4, 24/3, and
> 32)?
>
> Does 32 exist at all?
No, it doesn't on mine. But other SGI boxes could have them (the Fuel, for
example, has also a 30 bitplanes visual, because it can have 10 bits of
resolution for color channel). I would suggest to not rely at all on the
default visual, but try to select the closest one among the availables. My fix
for xcam was, as said, just a quick hack.
Andrea
More information about the sane-devel
mailing list