|
From: John M M. <jo...@us...> - 2004-09-03 00:18:38
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/vm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32204/squeak/platforms/Mac OS/vm Modified Files: sqMacWindow.c Log Message: 3.7.5b1 Use getSTWindow(), use better 16->32bit conversion algoritm Index: sqMacWindow.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/vm/sqMacWindow.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** sqMacWindow.c 3 Aug 2004 02:42:35 -0000 1.32 --- sqMacWindow.c 3 Sep 2004 00:18:28 -0000 1.33 *************** *** 31,34 **** --- 31,35 ---- #include "sqmacUIEvents.h" #include "sqMacUIMenuBar.h" + #include "sqMacEncoding.h" *************** *** 38,41 **** --- 39,43 ---- extern int getSavedWindowSize(); /* set from header when image file is loaded */ extern int setSavedWindowSize(int value); /* set from header when image file is loaded */ + extern struct VirtualMachine *interpreterProxy; /*** Variables -- Mac Related ***/ *************** *** 88,92 **** #if TARGET_API_MAC_CARBON ! GetWindowGreatestAreaDevice(stWindow,kWindowContentRgn,&dominantGDevice,&ignore); if (dominantGDevice == null) { success(false); --- 90,94 ---- #if TARGET_API_MAC_CARBON ! GetWindowGreatestAreaDevice(getSTWindow(),kWindowContentRgn,&dominantGDevice,&ignore); if (dominantGDevice == null) { success(false); *************** *** 95,99 **** screen = (**dominantGDevice).gdRect; #else ! dominantGDevice = getDominateDevice(stWindow,&ignore); if (dominantGDevice == null) { success(false); --- 97,101 ---- screen = (**dominantGDevice).gdRect; #else ! dominantGDevice = getDominateDevice(getSTWindow(),&ignore); if (dominantGDevice == null) { success(false); *************** *** 104,112 **** if (fullScreen) { ! GetPortBounds(GetWindowPort(stWindow),&rememberOldLocation); LocalToGlobal((Point*) &rememberOldLocation.top); LocalToGlobal((Point*) &rememberOldLocation.bottom); MenuBarHide(); ! GetPortBounds(GetWindowPort(stWindow),&portRect); oldWidth = portRect.right - portRect.left; oldHeight = portRect.bottom - portRect.top; --- 106,114 ---- if (fullScreen) { ! GetPortBounds(GetWindowPort(getSTWindow()),&rememberOldLocation); LocalToGlobal((Point*) &rememberOldLocation.top); LocalToGlobal((Point*) &rememberOldLocation.bottom); MenuBarHide(); ! GetPortBounds(GetWindowPort(getSTWindow()),&portRect); oldWidth = portRect.right - portRect.left; oldHeight = portRect.bottom - portRect.top; *************** *** 117,122 **** setSavedWindowSize((oldWidth << 16) + (oldHeight & 0xFFFF)); } ! MoveWindow(stWindow, screen.left, screen.top, true); ! SizeWindow(stWindow, width, height, true); setFullScreenFlag(true); } else { --- 119,124 ---- setSavedWindowSize((oldWidth << 16) + (oldHeight & 0xFFFF)); } ! MoveWindow(getSTWindow(), screen.left, screen.top, true); ! SizeWindow(getSTWindow(), width, height, true); setFullScreenFlag(true); } else { *************** *** 136,141 **** width = (width <= maxWidth) ? width : maxWidth; height = (height <= maxHeight) ? height : maxHeight; ! MoveWindow(stWindow, rememberOldLocation.left, rememberOldLocation.top, true); ! SizeWindow(stWindow, width, height, true); setFullScreenFlag(false); } --- 138,143 ---- width = (width <= maxWidth) ? width : maxWidth; height = (height <= maxHeight) ? height : maxHeight; ! MoveWindow(getSTWindow(), rememberOldLocation.left, rememberOldLocation.top, true); ! SizeWindow(getSTWindow(), width, height, true); setFullScreenFlag(false); } *************** *** 310,313 **** --- 312,334 ---- } } else if ( depth == 16 && pixDepth == 32) { + //(2r0 to: 2r11111000 by: 2r1000) collectWithIndex: [:e :i | (e + ((8/32*(i-1)) asInteger)) bitShift: 16] + long lookupTableB[32] = { + 0, 8, 16, 24, 33, 41, 49, 57, + 66, 74, 82, 90, 99, 107, 115, 123, + 132, 140, 148, 156, 165, 173, 181, 189, + 198, 206, 214, 222, 231, 239, 247, 255}; + + long lookupTableG[32] = { + 0, 2048, 4096, 6144, 8448, 10496, 12544, 14592, + 16896, 18944, 20992, 23040, 25344, 27392, 29440, 31488, + 33792, 35840, 37888, 39936, 42240, 44288, 46336, 48384, + 50688, 52736, 54784, 56832, 59136, 61184, 63232, 65280}; + + long lookupTableR[32] = { + 0, 524288, 1048576, 1572864, 2162688, 2686976, 3211264, 3735552, + 4325376, 4849664, 5373952, 5898240, 6488064, 7012352, 7536640, 8060928, + 8650752, 9175040, 9699328, 10223616, 10813440, 11337728, 11862016, 12386304, + 12976128, 13500416, 14024704, 14548992, 15138816, 15663104, 16187392, 16711680}; + while (affectedH--) { register long *to= (long *) out; *************** *** 317,331 **** while (count--) { /* see '11111'b needs to be '11111111'b */ target = *from++; ! r = (target & 0x00007C00); ! g = (target & 0x000003E0); b = (target & 0x0000001F); ! r = (r | (r << 3)) << 6; ! g = (g | (g << 3)) << 3; ! b = b | (b << 3) ; ! *to++ = r | g | b; ! /* *to++ = ((target & 0x00007C00) << 9) | ! ((target & 0x000003E0) << 6) | ! ((target & 0x0000001F) << 3); */ ! } in += pitch; --- 338,348 ---- while (count--) { /* see '11111'b needs to be '11111111'b */ target = *from++; ! r = (target & 0x00007C00) >> 10; ! g = (target & 0x000003E0) >> 5; b = (target & 0x0000001F); ! r = lookupTableR[r]; ! g = lookupTableG[g]; ! b = lookupTableB[b]; ! *to++ = r | g | b ; } in += pitch; *************** *** 567,571 **** CopyCStringToPascal(title,tempTitle); #ifndef IHAVENOHEAD ! SetWTitle(stWindow, tempTitle); #endif } --- 584,588 ---- CopyCStringToPascal(title,tempTitle); #ifndef IHAVENOHEAD ! SetWTitle(getSTWindow(), tempTitle); #endif } *************** *** 598,604 **** #if TARGET_API_MAC_CARBON ! GetWindowGreatestAreaDevice(stWindow,kWindowContentRgn,&mainDevice,&ignore); #else ! mainDevice = getDominateDevice(stWindow,&ignore); #endif --- 615,621 ---- #if TARGET_API_MAC_CARBON ! GetWindowGreatestAreaDevice(getSTWindow(),kWindowContentRgn,&mainDevice,&ignore); #else ! mainDevice = getDominateDevice(getSTWindow(),&ignore); #endif *************** *** 611,620 **** #ifndef BROWSERPLUGIN int ioScreenSize(void) { ! int w = 10, h = 10; Rect portRect; #ifndef IHAVENOHEAD ! if (stWindow != nil) { ! GetPortBounds(GetWindowPort(stWindow),&portRect); w = portRect.right - portRect.left; h = portRect.bottom - portRect.top; --- 628,640 ---- #ifndef BROWSERPLUGIN int ioScreenSize(void) { ! int w, h; Rect portRect; + w = (unsigned) getSavedWindowSize() >> 16; + h= getSavedWindowSize() & 0xFFFF; + #ifndef IHAVENOHEAD ! if (getSTWindow() != nil) { ! GetPortBounds(GetWindowPort(getSTWindow()),&portRect); w = portRect.right - portRect.left; h = portRect.bottom - portRect.top; *************** *** 627,631 **** int ioSetCursor(int cursorBitsIndex, int offsetX, int offsetY) { /* Old version; forward to new version. */ ! return ioSetCursorWithMask(cursorBitsIndex, nil, offsetX, offsetY); } --- 647,652 ---- int ioSetCursor(int cursorBitsIndex, int offsetX, int offsetY) { /* Old version; forward to new version. */ ! ioSetCursorWithMask(cursorBitsIndex, nil, offsetX, offsetY); ! return 0; } *************** *** 749,755 **** #if TARGET_API_MAC_CARBON ! GetWindowGreatestAreaDevice(stWindow,kWindowContentRgn,&dominantGDevice,&ignore); #else ! dominantGDevice = getDominateDevice(stWindow,&ignore); #endif if (dominantGDevice == null) { --- 770,776 ---- #if TARGET_API_MAC_CARBON ! GetWindowGreatestAreaDevice(getSTWindow(),kWindowContentRgn,&dominantGDevice,&ignore); #else ! dominantGDevice = getDominateDevice(getSTWindow(),&ignore); #endif if (dominantGDevice == null) { *************** *** 811,815 **** if (TrackBox(theWindow, theEvent->where, zoomDir)) { SetPortWindowPort(theWindow); ! GetPortBounds(GetWindowPort(stWindow),&windRect); EraseRect(&windRect); // recommended for cosmetic reasons --- 832,836 ---- if (TrackBox(theWindow, theEvent->where, zoomDir)) { SetPortWindowPort(theWindow); ! GetPortBounds(GetWindowPort(theWindow),&windRect); EraseRect(&windRect); // recommended for cosmetic reasons *************** *** 979,983 **** pascal void ModeListIterator(void *userData, DMListIndexType itemIndex, DMDisplayModeListEntryPtr displaymodeInfo) { - #pragma unused(itemIndex) unsigned long depthCount; short iCount; --- 1000,1003 ---- *************** *** 1210,1214 **** if (context == NULL) { ! CreateCGContextForPort(GetWindowPort(stWindow), &context); } --- 1230,1234 ---- if (context == NULL) { ! CreateCGContextForPort(GetWindowPort(getSTWindow()), &context); } *************** *** 1279,1283 **** int osxGetSurfaceFormat(int handle, int* width, int* height, int* depth, int* isMSB) { ! CGrafPtr windowPort = GetWindowPort(stWindow); PixMapHandle pix; Rect rectangle; --- 1299,1303 ---- int osxGetSurfaceFormat(int handle, int* width, int* height, int* depth, int* isMSB) { ! CGrafPtr windowPort = GetWindowPort(getSTWindow()); PixMapHandle pix; Rect rectangle; *************** *** 1297,1301 **** static Boolean firstTime=true; static int offsetTitle=0; ! CGrafPtr windowPort = GetWindowPort(stWindow); PixMapHandle pixMap; --- 1317,1321 ---- static Boolean firstTime=true; static int offsetTitle=0; ! CGrafPtr windowPort = GetWindowPort(getSTWindow()); PixMapHandle pixMap; *************** *** 1310,1314 **** rect = NewRgn(); ! GetWindowRegion(stWindow,kWindowTitleBarRgn,rect); GetRegionBounds(rect,&structureRect); offsetTitle = (structureRect.bottom- structureRect.top)* *pitch; --- 1330,1334 ---- rect = NewRgn(); ! GetWindowRegion(getSTWindow(),kWindowTitleBarRgn,rect); GetRegionBounds(rect,&structureRect); offsetTitle = (structureRect.bottom- structureRect.top)* *pitch; *************** *** 1320,1324 **** int osxUnlockSurface(int handle, int x, int y, int w, int h) { ! UnlockPortBits(GetWindowPort(stWindow)); } --- 1340,1344 ---- int osxUnlockSurface(int handle, int x, int y, int w, int h) { ! UnlockPortBits(GetWindowPort(getSTWindow())); } *************** *** 1331,1335 **** SetRectRgn(maskRect, x, y, x+w, y+h); ! QDFlushPortBuffer(GetWindowPort(stWindow), maskRect); } --- 1351,1355 ---- SetRectRgn(maskRect, x, y, x+w, y+h); ! QDFlushPortBuffer(GetWindowPort(getSTWindow()), maskRect); } |