[BUG][FIX](Mac)ioShowDisplay incorrectly sets up PixMap fields

Duane Maxwell dmaxwell at exobox.com
Mon Sep 18 20:03:30 UTC 2000


There's a bug in sqMacWindow.c which manifests itself when running Squeak
in either 16- or 32-bit, but running the Mac display at 8-bit ("256
colors"). With Squeak in 16-bit, the display is tinted green, in 32-bit,
the display is tinted magenta.   The bug is actually worse than that, but
QuickDraw covers up for it the rest of the time.

The bug is in ioShowDisplay() - when faking out the Squeak Display bitmap
as a Macintosh PixMap preparing to call CopyBits, the component size field
(cmpSize) of the PixMap is incorrectly set to the total size of the pixel
rather than the size of the color component.  For depth 16, the cmpSize
should be 5; for depth 32, the cmpSize should be 8; for other depths, it
should be the depth (1,2,4,8). In addition, for direct color depths, the
component count field (cmpCount) should be set to 3, 1 otherwise.  See
IM-VI 17-5..17-6.

Frankly, it's a miracle this code works at all - there's probably some
defensive code in QuickDraw which is allowing this to function.

It should read:

(*stPixMap)->pixelSize = depth;
if (depth<=8) {
	(*stPixMap)->cmpSize = depth;
	(*stPixMap)->cmpCount = 1;
} else if (depth==16) {
	(*stPixMap)->cmpSize = 5;
	(*stPixMap)->cmpCount = 3;
} else if (depth==32) {
	(*stPixMap)->cmpSize = 8;
	(*stPixMap)->cmpCount = 3;
}







More information about the Squeak-dev mailing list