Depth1Image.st
changeset 97 dd6116883ac0
parent 89 ea2bf46eb669
child 118 25e775072a89
--- a/Depth1Image.st	Sat Feb 11 17:47:17 1995 +0100
+++ b/Depth1Image.st	Wed Feb 15 11:36:19 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.10 1995-02-06 00:35:47 claus Exp $
+$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.11 1995-02-15 10:35:20 claus Exp $
 '!
 
 !Depth1Image class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.10 1995-02-06 00:35:47 claus Exp $
+$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.11 1995-02-15 10:35:20 claus Exp $
 "
 !
 
@@ -138,15 +138,17 @@
      mask        "{Class: SmallInteger}"|
 
 %{  /* NOCONTEXT */
-    if (__isByteArray(_INST(bytes))
-     && _isSmallInteger(x)
-     && _isSmallInteger(y)
-     && _isSmallInteger(_INST(width)) ) {
-	int _w = _intVal(_INST(width));
+
+    OBJ b = _INST(bytes);
+    OBJ w = _INST(width);
+
+    if (__isByteArray(b) && __bothSmallInteger(x, y) && __isSmallInteger(w) ) {
+	int _w = _intVal(w);
 	int _y = _intVal(y);
 	int _x = _intVal(x);
 	unsigned _byte;
-	_byte = _ByteArrayInstPtr(_INST(bytes))->ba_element[(_w + 7) / 8 * _y + (_x / 8)];
+
+	_byte = _ByteArrayInstPtr(b)->ba_element[(_w + 7) / 8 * _y + (_x / 8)];
 	RETURN( (_byte & (0x80 >> (_x % 8))) ? _MKSMALLINT(1) : _MKSMALLINT(0) );
     }
 %}.
@@ -218,20 +220,21 @@
      mask        "{Class: SmallInteger}"|
 
 %{  /* NOCONTEXT */
-    if (__isByteArray(_INST(bytes))
-     && _isSmallInteger(x)
-     && _isSmallInteger(y)
-     && _isSmallInteger(_INST(width)) ) {
-	int _w = _intVal(_INST(width));
+
+    OBJ b = _INST(bytes);
+    OBJ w = _INST(width);
+
+    if (__isByteArray(b) && __bothSmallInteger(x, y) && __isSmallInteger(w) ) {
+	int _w = _intVal(w);
 	int _y = _intVal(y);
 	int _x = _intVal(x);
 	int _idx;
 
 	_idx = (_w + 7) / 8 * _y + (_x / 8);
 	if (aPixelValue == _MKSMALLINT(0)) {
-	    _ByteArrayInstPtr(_INST(bytes))->ba_element[_idx] &= ~(0x80 >> (_x % 8));
+	    _ByteArrayInstPtr(b)->ba_element[_idx] &= ~(0x80 >> (_x % 8));
 	} else {
-	    _ByteArrayInstPtr(_INST(bytes))->ba_element[_idx] |= (0x80 >> (_x % 8));
+	    _ByteArrayInstPtr(b)->ba_element[_idx] |= (0x80 >> (_x % 8));
 	}
 	RETURN( self );
     }
@@ -468,18 +471,19 @@
     REGISTER int outcnt, bits, bit, mask, incnt;
     int shift;
     unsigned char byte1, byte2, byte3, byte4;
+    OBJ w = _INST(width);
 
     /* helper for monochrome magnification by 2 */
     static unsigned char mag1[16] = {0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f, 
 				     0xc0, 0xc3, 0xcc, 0xcf, 0xf0, 0xf3, 0xfc, 0xff};
 
-    if (_isSmallInteger(srcStart) && _isSmallInteger(dstStart)
-     && _isSmallInteger(_INST(width)) && _isSmallInteger(mX)
+    if (__bothSmallInteger(srcStart, dstStart)
+     && __bothSmallInteger(w, mX)
      && __isByteArray(srcBytes) && __isByteArray(dstBytes)) {
 	_mag = _intVal(mX);
 	srcP = _ByteArrayInstPtr(srcBytes)->ba_element - 1 + _intVal(srcStart);
 	dstP = _ByteArrayInstPtr(dstBytes)->ba_element - 1 + _intVal(dstStart);
-	_pixels = _intVal(_INST(width));
+	_pixels = _intVal(w);
 
 	switch (_mag) {
 	    case 1: