Graphics implementation on Windows

Andreas Raab raab at isgnw.cs.Uni-Magdeburg.DE
Sun Feb 15 14:57:26 UTC 1998


> > I note that, since I'm in 32bits, there's no byte swapping in the Windows
> > VM. 
> 
> Not by the VM but still in the graphics driver :-( I tried to make the
> port as easy as possible not as fast as possible.

Looks like a need to give a little explanation of the above:
There are basically two things to be done by the VM. One is byte reversal
since the pixels in forms may be in different order. For Intel processors
this means each word has to be byte-reversed in 1,2,4 and 8 bit color
depth. In 16 bit color depth a two-byte reversal needs to be done. In
32bit color depth no byte reversal is necessary for the pixel order.

However, assuming that you have the correct pixel order does not mean that
you're already finished. The second part (which is entirely done by the
graphics driver in the Win32 port) concerns color conversion. If your
screen depth is 8bit how do you map a 32bit Squeak display depth to it?
Fortunately, Win32 supports generic color mapping by using device
independent bitmaps.  By this you can leave the whole part of color
conversion directly to the graphics driver. While this method is extremely
convenient for programming it can be painfully slow if the graphics driver
is not optimized with respect to this operation. 

In the windows port, I used the generic conversion for two reasons:
First, I wanted to keep the port simple at this point. Adding conversion
functions (which might be faster than some of the graphics drivers) is
somewhat tricky (see the Unix port where this conversion is done by the
VM). Secondly, there would be lots of conversion functions necessary
because of the high number of display modes supported. Here are some out
of my head (CI = color indexed):
* 1bit CI
* 2bit CI (DirectX only)
* 4bit CI
* 8bit CI
* 12bit CI (OpenGL/DirectX only)
* 3/3/2 bit RGB (OpenGL/DirectX only)
* 5/5/5 bit RGB
* 6/5/5 bit RGB
* 5/6/5 bit RGB
* 5/5/6 bit RGB
* 8/8/8 bit RBG
* 12/12/12 bit RGB
* 8/8/8/8 bit RGBA (OpenGL/DirectX only)

Thinking of the 6 color depths we have in Squeak (1,2,4,8,16,32 bit) there
would be 6x13 = 78 conversion functions necessary :-\ 

Coming back to the original question, even if we have appropriate color
depths in Squeak and in the OS, there is still color conversion necessary
because in the RGB modes the order of the red, green, and blue parts is
exactly the other way around the Intel based system wants it :-(

Hope this explains my statement a bit more,
  Andreas
-- 
Linear algebra is your friend - Trigonometry is your enemy.
+===== Andreas Raab ============= (raab at isg.cs.uni-magdeburg.de) =====+
I Department of Simulation and Graphics      Phone: +49 391 671 8065  I
I University of Magdeburg, Germany           Fax:   +49 391 671 1164  I
+=============< http://isgwww.cs.uni-magdeburg.de/~raab >=============+





More information about the Squeak-dev mailing list