WinWorkstation.st
changeset 5546 8387e6a32b6d
parent 5545 24427576c2ac
child 5549 fd4fc69df52d
--- a/WinWorkstation.st	Fri Dec 11 11:14:10 2009 +0100
+++ b/WinWorkstation.st	Mon Feb 01 19:16:34 2010 +0100
@@ -7853,79 +7853,76 @@
     unsigned char *allocatedBits = 0;
     unsigned char fastBits[10000];
 
-    if (__bothSmallInteger(w, h)
-     && _isNonNilObject(anArray)) {
-	OBJ cls = __qClass(anArray);
-
-	b_width = __intVal(w);
-	b_height = __intVal(h);
-	bytesPerRowST = (b_width + 7) / 8;
-	bytesPerRowWN = ((b_width + 15) / 16) * 2;
-	padding = bytesPerRowWN - bytesPerRowST;
-
-	if ((padding == 0) && (__isByteArrayLike(anArray))) {
-	    b_bits = __ByteArrayInstPtr(anArray)->ba_element;
-	    cp = 0;
-	} else {
-	    int nBytes = b_height * bytesPerRowWN;
-
-	    if (nBytes < sizeof(fastBits)) {
-		cp = b_bits = fastBits;
-	    } else {
-		cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
-		if (! cp) goto fail;
-	    }
-	}
-	if (cp) {
-	    if (__isArrayLike(anArray)) {
-		OBJ *op;
-
-		index = 1;
-		op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
-		for (row = b_height; row; row--) {
-		    for (col = bytesPerRowST; col; col--) {
-			num = *op++;
-			if (! __isSmallInteger(num))
-			    goto fail;
-			*cp++ = __intVal(num);
-		    }
-		    cp += padding;
-		}
-	    } else if (__isByteArrayLike(anArray)) {
-		unsigned char *pBits;
-
-		pBits = __ByteArrayInstPtr(anArray)->ba_element;
-		for (row = b_height; row; row--) {
-		    for (col = bytesPerRowST; col; col--) {
-			*cp++ = ( *pBits++ /*^ 0xFF*/ );
-		    }
-		    cp += padding;
-		}
-	    } else {
-		goto fail;
-	    }
-	}
-	CPRINTF(("create bitmap ...\n"));
-
-	newBitmapHandle = CreateBitmap(b_width, b_height, 1, 1, b_bits );
-
-	if (newBitmapHandle ) {
+    if (__bothSmallInteger(w, h) && __isNonNilObject(anArray)) {
+        b_width = __intVal(w);
+        b_height = __intVal(h);
+        bytesPerRowST = (b_width + 7) / 8;
+        bytesPerRowWN = ((b_width + 15) / 16) * 2;
+        padding = bytesPerRowWN - bytesPerRowST;
+
+        if ((padding == 0) && (__isByteArrayLike(anArray))) {
+            b_bits = __ByteArrayInstPtr(anArray)->ba_element;
+            cp = 0;
+        } else {
+            int nBytes = b_height * bytesPerRowWN;
+
+            if (nBytes < sizeof(fastBits)) {
+                cp = b_bits = fastBits;
+            } else {
+                cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
+                if (! cp) goto fail;
+            }
+        }
+        if (cp) {
+            if (__qIsArrayLike(anArray)) {
+                OBJ *op;
+
+                index = 1;
+                op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
+                for (row = b_height; row; row--) {
+                    for (col = bytesPerRowST; col; col--) {
+                        num = *op++;
+                        if (! __isSmallInteger(num))
+                            goto fail;
+                        *cp++ = __intVal(num);
+                    }
+                    cp += padding;
+                }
+            } else if (__qIsByteArrayLike(anArray)) {
+                unsigned char *pBits;
+
+                pBits = __ByteArrayInstPtr(anArray)->ba_element;
+                for (row = b_height; row; row--) {
+                    for (col = bytesPerRowST; col; col--) {
+                        *cp++ = ( *pBits++ /*^ 0xFF*/ );
+                    }
+                    cp += padding;
+                }
+            } else {
+                goto fail;
+            }
+        }
+        CPRINTF(("create bitmap ...\n"));
+
+        newBitmapHandle = CreateBitmap(b_width, b_height, 1, 1, b_bits );
+
+        if (newBitmapHandle ) {
 #ifdef COUNT_BMP_RESOURCES
-	    __cnt_bitmap++;
-	    RES_BMP_PRINTF(("CreateBitmap %x %d\n",newBitmapHandle,__cnt_bitmap));
-#endif
-	    DDPRINTF(("returning bitmap %x ...\n", newBitmapHandle));
-	    if (allocatedBits) {
-		free(allocatedBits);
-	    }
-	    RETURN ( __MKOBJ(newBitmapHandle));
-	}
+            __cnt_bitmap++;
+            RES_BMP_PRINTF(("CreateBitmap %x %d\n",newBitmapHandle,__cnt_bitmap));
+#endif
+            DDPRINTF(("returning bitmap %x ...\n", newBitmapHandle));
+            if (allocatedBits) {
+                free(allocatedBits);
+            }
+            RETURN ( __MKEXTERNALADDRESS(newBitmapHandle));
+        }
     }
 fail: ;
     DDPRINTF(("create bitmap FAILED!!!\n"));
     if (allocatedBits) {
-	CPRINTF(("freeing up bitmap bits ...\n"));
-	free(allocatedBits);
+        CPRINTF(("freeing up bitmap bits ...\n"));
+        free(allocatedBits);
     }
     CPRINTF(("returning nil ...\n"));
     RETURN ( nil );
@@ -9593,12 +9590,12 @@
     "free Win32 data (and remove the drop-file)"
 %{
     if (__isExternalAddress(dropHandle)) {
-	HDROP hDrop = (HDROP)(__MKCP(dropHandle));
-
-	__externalAddressVal(dropHandle) = 0;
-	if (hDrop) {
-	    DragFinish(hDrop);
-	}
+        HDROP hDrop = (HDROP)__externalAddressVal(dropHandle);
+
+        __externalAddressVal(dropHandle) = 0;
+        if (hDrop) {
+            DragFinish(hDrop);
+        }
     }
 %}
 ! !
@@ -18847,11 +18844,11 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.417 2009-12-11 10:14:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.418 2010-02-01 18:16:34 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.417 2009-12-11 10:14:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.418 2010-02-01 18:16:34 stefan Exp $'
 ! !
 
 WinWorkstation initialize!