|
From: John M M. <jo...@us...> - 2003-11-20 01:36:30
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/vm
In directory sc8-pr-cvs1:/tmp/cvs-serv451/squeak/platforms/Mac OS/vm
Modified Files:
sqMacWindow.c
Log Message:
3.6.1b6 clean casts and usage of carbon defines to see if we can compile under os-9. Also add code for 16/32 to 8bit, but it seems under os-x we never get 8 bit windows, only 16 which are rended as 8bit
Index: sqMacWindow.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/vm/sqMacWindow.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** sqMacWindow.c 17 Nov 2003 23:39:26 -0000 1.28
--- sqMacWindow.c 20 Nov 2003 01:35:47 -0000 1.29
***************
*** 145,149 ****
#define bytesPerLine(width, depth) ((((width)*(depth) + 31) >> 5) << 2)
! #ifndef TARGET_API_MAC_CARBON
int ioShowDisplay(
int dispBitsIndex, int width, int height, int depth,
--- 145,149 ----
#define bytesPerLine(width, depth) ((((width)*(depth) + 31) >> 5) << 2)
! #if !TARGET_API_MAC_CARBON
int ioShowDisplay(
int dispBitsIndex, int width, int height, int depth,
***************
*** 229,234 ****
}
LockPortBits(windowPort);
!
{
PixMapHandle pix;
--- 229,235 ----
}
+ #if TARGET_API_MAC_CARBON
LockPortBits(windowPort);
! #endif
{
PixMapHandle pix;
***************
*** 264,269 ****
while (affectedH--) {
register long i,count= bytes/2;
! register short *to= out;
! register short *from= in;
while (count--)
*to++= *from++;
--- 265,270 ----
while (affectedH--) {
register long i,count= bytes/2;
! register short *to= (short *) out;
! register short *from= (short *) in;
while (count--)
*to++= *from++;
***************
*** 273,278 ****
else while (affectedH--) {
register long count= bytes/4;
! register long *to= out;
! register long *from= in;
while (count--)
*to++= *from++;
--- 274,279 ----
else while (affectedH--) {
register long count= bytes/4;
! register long *to= (long *) out;
! register long *from= (long *)in;
while (count--)
*to++= *from++;
***************
*** 282,287 ****
} else if ( depth == 16 && pixDepth == 32) {
while (affectedH--) {
! register long *to= out;
! register short *from= in;
register long count= bytes/2,target,r,g,b;
--- 283,288 ----
} else if ( depth == 16 && pixDepth == 32) {
while (affectedH--) {
! register long *to= (long *) out;
! register short *from= (short *) in;
register long count= bytes/2,target,r,g,b;
***************
*** 305,310 ****
} else if (depth == 32 && pixDepth == 16) {
while (affectedH--) {
! register short *to= out;
! register long *from= in;
register long count= bytes/4,target;
while (count--) {
--- 306,311 ----
} else if (depth == 32 && pixDepth == 16) {
while (affectedH--) {
! register short *to= (short *) out;
! register long *from= (long *) in;
register long count= bytes/4,target;
while (count--) {
***************
*** 319,324 ****
} else if (depth == 8 && pixDepth == 16) {
while (affectedH--) {
! short *to= out;
! unsigned char *from= in;
long count= bytes;
unsigned short r,g,b;
--- 320,325 ----
} else if (depth == 8 && pixDepth == 16) {
while (affectedH--) {
! short *to= (short *) out;
! unsigned char *from= ( unsigned char *) in;
long count= bytes;
unsigned short r,g,b;
***************
*** 338,343 ****
}else if (depth == 8 && pixDepth == 32) {
while (affectedH--) {
! long *to= out;
! unsigned char *from= in;
long count= bytes;
unsigned short r,g,b;
--- 339,344 ----
}else if (depth == 8 && pixDepth == 32) {
while (affectedH--) {
! long *to= (long *) out;
! unsigned char *from= (unsigned char *) in;
long count= bytes;
unsigned short r,g,b;
***************
*** 355,364 ****
--- 356,407 ----
out += pixPitch;
}
+ } else if (depth == 16 && pixDepth == 8) { // Untested, perhaps will not get called
+ SetPort(windowPort);
+ while (affectedH--) {
+ unsigned char *to= (unsigned char *) out;
+ unsigned short *from= (unsigned short *) in;
+ long count= bytes/2;
+ unsigned short target;
+ RGBColor colorPixel;
+
+ while (count--) {
+ target = *from++;
+ colorPixel.red = (target & 0x7C00) >> 10;
+ colorPixel.green = (target & 0x03E0) >> 5;
+ colorPixel.blue = (target & 0x001F);
+ *to++ = (unsigned char) Color2Index(&colorPixel);
+ }
+ in += pitch;
+ out += pixPitch;
+ }
+ } else if (depth == 32 && pixDepth == 8) {
+ SetPort(windowPort);
+ while (affectedH--) {
+ unsigned char *to= (unsigned char *) out;
+ unsigned short *from= (unsigned short *) in;
+ long count= bytes/4;
+ unsigned long target;
+ RGBColor colorPixel;
+
+ while (count--) {
+ target = *from++;
+ colorPixel.red = (target & 0x00FF0000) >> 16;
+ colorPixel.green = (target & 0x0000FF00) >> 8;
+ colorPixel.blue = (target & 0x000000FF);
+ *to++ = (unsigned char) Color2Index(&colorPixel);
+ }
+ in += pitch;
+ out += pixPitch;
+ }
}
+
+
+ #if TARGET_API_MAC_CARBON
SetRectRgn(maskRect, affectedL, affectedT, affectedR, affectedB);
QDFlushPortBuffer(windowPort, maskRect);
UnlockPortBits(windowPort);
+ #endif
}
***************
*** 1224,1227 ****
--- 1267,1271 ----
#endif
+ #if JMMFoo
#include "SurfacePlugin.h"
***************
*** 1324,1325 ****
--- 1368,1370 ----
}
+ #endif
\ No newline at end of file
|