--- a/WinWorkstat.st Fri Dec 13 19:01:16 1996 +0100
+++ b/WinWorkstat.st Tue Dec 17 18:49:24 1996 +0100
@@ -1286,7 +1286,6 @@
wiconViewId := wiconView id
].
weventMask := aView eventMask.
-'extent:' print. extent printCR.
%{ /* STACK:16000 */
extern void *__getHInstance(), *__getHPrevInstance();
@@ -1527,6 +1526,55 @@
%{ /* UNLIMITEDSTACK */
+ HANDLE newBitmapHandle;
+ unsigned char fastBits[10000];
+ int b_width, b_height, bytesPerRowST, bytesPerRowWN, padding, nBytes;
+ int row, col;
+ unsigned char *cp, *bPits;
+ unsigned char *b_bits, *allocatedBits;
+
+ if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
+ b_width = __intVal(w);
+ b_height = __intVal(h);
+ bytesPerRowST = (b_width + 7) / 8;
+ bytesPerRowWN = (b_width + 15) / 16;
+ padding = bytesPerRowWN - bytesPerRowST;
+ nBytes = b_height * bytesPerRowWN;
+ if (nBytes < sizeof(fastBits)) {
+ cp = b_bits = fastBits;
+ allocatedBits = 0;
+ } else {
+ cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
+ if (! cp) goto fail;
+ }
+
+ if (__qClass(anArray) == @global(Array)) {
+ goto fail;
+ } else {
+ if (__qClass(anArray) == @global(ByteArray)) {
+ pBits = __ByteArrayInstPtr(anArray)->ba_element;
+ for (row = b_height; row; row--) {
+ for (col = b_height*bytesPerRow; col; col--) {
+ *cp++ = *pBits++;
+ }
+ cp += padding;
+ }
+ } else {
+ goto fail;
+ }
+ }
+ newBitmapHandle = CreateBitmap(b_width, b_height,
+ 1, 1,
+ b_bits
+ );
+
+ DPRINTF(("bitmap handle = %x\n", newBitmapHandle));
+
+fail: ;
+ if (allocatedBits)
+ free(allocatedBits);
+ RETURN ( newBitmapHandle ? __MKOBJ(newBitmapHandle) : nil );
+ }
RETURN ( nil );
%}
!
@@ -4793,7 +4841,7 @@
!WinWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Attic/WinWorkstat.st,v 1.15 1996-11-21 18:42:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Attic/WinWorkstat.st,v 1.16 1996-12-17 17:49:24 cg Exp $'
! !
WinWorkstation initialize!
--- a/WinWorkstation.st Fri Dec 13 19:01:16 1996 +0100
+++ b/WinWorkstation.st Tue Dec 17 18:49:24 1996 +0100
@@ -1286,7 +1286,6 @@
wiconViewId := wiconView id
].
weventMask := aView eventMask.
-'extent:' print. extent printCR.
%{ /* STACK:16000 */
extern void *__getHInstance(), *__getHPrevInstance();
@@ -1527,6 +1526,55 @@
%{ /* UNLIMITEDSTACK */
+ HANDLE newBitmapHandle;
+ unsigned char fastBits[10000];
+ int b_width, b_height, bytesPerRowST, bytesPerRowWN, padding, nBytes;
+ int row, col;
+ unsigned char *cp, *bPits;
+ unsigned char *b_bits, *allocatedBits;
+
+ if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
+ b_width = __intVal(w);
+ b_height = __intVal(h);
+ bytesPerRowST = (b_width + 7) / 8;
+ bytesPerRowWN = (b_width + 15) / 16;
+ padding = bytesPerRowWN - bytesPerRowST;
+ nBytes = b_height * bytesPerRowWN;
+ if (nBytes < sizeof(fastBits)) {
+ cp = b_bits = fastBits;
+ allocatedBits = 0;
+ } else {
+ cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
+ if (! cp) goto fail;
+ }
+
+ if (__qClass(anArray) == @global(Array)) {
+ goto fail;
+ } else {
+ if (__qClass(anArray) == @global(ByteArray)) {
+ pBits = __ByteArrayInstPtr(anArray)->ba_element;
+ for (row = b_height; row; row--) {
+ for (col = b_height*bytesPerRow; col; col--) {
+ *cp++ = *pBits++;
+ }
+ cp += padding;
+ }
+ } else {
+ goto fail;
+ }
+ }
+ newBitmapHandle = CreateBitmap(b_width, b_height,
+ 1, 1,
+ b_bits
+ );
+
+ DPRINTF(("bitmap handle = %x\n", newBitmapHandle));
+
+fail: ;
+ if (allocatedBits)
+ free(allocatedBits);
+ RETURN ( newBitmapHandle ? __MKOBJ(newBitmapHandle) : nil );
+ }
RETURN ( nil );
%}
!
@@ -4793,7 +4841,7 @@
!WinWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.15 1996-11-21 18:42:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.16 1996-12-17 17:49:24 cg Exp $'
! !
WinWorkstation initialize!