ImageReader.st
changeset 5481 93de6ee2ed5a
parent 5318 c1947a63d265
child 5527 216f389ffe42
--- a/ImageReader.st	Thu Nov 05 15:37:51 2009 +0100
+++ b/ImageReader.st	Thu Nov 05 15:37:53 2009 +0100
@@ -1006,15 +1006,15 @@
      count bytes from srcBytes are decompressed into dstBytes.
      Calls primitive c function for speed"
 %{
-    if (__isByteArray(srcBytes)
+    if (__isByteArrayLike(srcBytes)
      && __isByteArray(dstBytes)
      && __bothSmallInteger(offset, count)) {
-	if (__decodeCCITTgroup3__(__ByteArrayInstPtr(srcBytes)->ba_element,
-				  __ByteArrayInstPtr(dstBytes)->ba_element
-				  + __intVal(offset) - 1,
-				  __intVal(count))) {
-	    RETURN ( self );
-	}
+        if (__decodeCCITTgroup3__(__ByteArrayInstPtr(srcBytes)->ba_element,
+                                  __ByteArrayInstPtr(dstBytes)->ba_element
+                                  + __intVal(offset) - 1,
+                                  __intVal(count))) {
+            RETURN ( self );
+        }
     }
 %}
 .
@@ -1026,20 +1026,20 @@
      count bytes from srcBytes are decompressed into dstBytes.
      Calls primitive c function for speed"
 %{
-    if (__isByteArray(srcBytes)
+    if (__isByteArrayLike(srcBytes)
      && __isByteArray(dstBytes)
      && __bothSmallInteger(codeLen, offset)
      && __isSmallInteger(count)) {
-	if (__decodeGIF__(__ByteArrayInstPtr(srcBytes)->ba_element,
-			  __ByteArrayInstPtr(dstBytes)->ba_element
-						+__intVal(offset) - 1,
-			  __intVal(count),
-			  __intVal(codeLen),
-			  __byteArraySize(srcBytes),
-			  __byteArraySize(dstBytes)
-			 )) {
-	    RETURN ( self );
-	}
+        if (__decodeGIF__(__ByteArrayInstPtr(srcBytes)->ba_element,
+                          __ByteArrayInstPtr(dstBytes)->ba_element
+                                                +__intVal(offset) - 1,
+                          __intVal(count),
+                          __intVal(codeLen),
+                          __byteArraySize(srcBytes),
+                          __byteArraySize(dstBytes)
+                         )) {
+            RETURN ( self );
+        }
     }
 %}
 .
@@ -1051,18 +1051,18 @@
      count bytes from srcBytes are decompressed into dstBytes.
      Calls primitive c function for speed"
 %{
-    if (__isByteArray(srcBytes)
+    if (__isByteArrayLike(srcBytes)
      && __isByteArray(dstBytes)
      && __bothSmallInteger(offset, count)) {
-	if (__decodeLZW__(__ByteArrayInstPtr(srcBytes)->ba_element,
-			  __ByteArrayInstPtr(dstBytes)->ba_element
-					      + __intVal(offset) - 1,
-			  __intVal(count),
-			  __byteArraySize(srcBytes),
-			  __byteArraySize(dstBytes)
-			)) {
-	    RETURN ( self );
-	}
+        if (__decodeLZW__(__ByteArrayInstPtr(srcBytes)->ba_element,
+                          __ByteArrayInstPtr(dstBytes)->ba_element
+                                              + __intVal(offset) - 1,
+                          __intVal(count),
+                          __byteArraySize(srcBytes),
+                          __byteArraySize(dstBytes)
+                        )) {
+            RETURN ( self );
+        }
     }
 %}
 .
@@ -1390,7 +1390,7 @@
     unsigned char *outEnd;
 #endif
 
-    if (! __isByteArray(pixels)) goto fail;
+    if (! __isByteArrayLike(pixels)) goto fail;
     if (! __isByteArray(maskArray)) goto fail;
 
     __inP = __ByteArrayInstPtr(pixels)->ba_element;
@@ -1404,65 +1404,65 @@
 */
 
     for (__y=__h; __y>0; __y--) {
-	__outBits = 0;
-	__nOut = 8;
-	__nextOutRow = __outP + __bpr;
+        __outBits = 0;
+        __nOut = 8;
+        __nextOutRow = __outP + __bpr;
 
-	for (__x=__w; __x>=8; __x-=8) {
-	    if (__inP[0] != __maskPixel) { __outBits |= 0x80; };
-	    if (__inP[1] != __maskPixel) { __outBits |= 0x40; };
-	    if (__inP[2] != __maskPixel) { __outBits |= 0x20; };
-	    if (__inP[3] != __maskPixel) { __outBits |= 0x10; };
-	    if (__inP[4] != __maskPixel) { __outBits |= 0x08; };
-	    if (__inP[5] != __maskPixel) { __outBits |= 0x04; };
-	    if (__inP[6] != __maskPixel) { __outBits |= 0x02; };
-	    if (__inP[7] != __maskPixel) { __outBits |= 0x01; };
-	    __inP += 8;
-	    *__outP++ = __outBits;
-	    __outBits = 0;
-	}
-	for (; __x>0; __x--) {
-	    __outBits <<= 1;
-	    if (*__inP != __maskPixel) {
-		__outBits |= 1;
-	    }
-	    __inP++;
+        for (__x=__w; __x>=8; __x-=8) {
+            if (__inP[0] != __maskPixel) { __outBits |= 0x80; };
+            if (__inP[1] != __maskPixel) { __outBits |= 0x40; };
+            if (__inP[2] != __maskPixel) { __outBits |= 0x20; };
+            if (__inP[3] != __maskPixel) { __outBits |= 0x10; };
+            if (__inP[4] != __maskPixel) { __outBits |= 0x08; };
+            if (__inP[5] != __maskPixel) { __outBits |= 0x04; };
+            if (__inP[6] != __maskPixel) { __outBits |= 0x02; };
+            if (__inP[7] != __maskPixel) { __outBits |= 0x01; };
+            __inP += 8;
+            *__outP++ = __outBits;
+            __outBits = 0;
+        }
+        for (; __x>0; __x--) {
+            __outBits <<= 1;
+            if (*__inP != __maskPixel) {
+                __outBits |= 1;
+            }
+            __inP++;
 
 /*
  printf("x: %d  bits: %x\n", __x, __outBits);
 */
-	    if (--__nOut == 0) {
+            if (--__nOut == 0) {
 #ifdef DEBUG
-		if (__outP >= outEnd) {
-		    if (@global(InfoPrinting) == true) {
-			console_fprintf(stderr, "oops %d\n", __LINE__);
-		    }
-		    goto fail;
-		}
+                if (__outP >= outEnd) {
+                    if (@global(InfoPrinting) == true) {
+                        console_fprintf(stderr, "oops %d\n", __LINE__);
+                    }
+                    goto fail;
+                }
 #endif
-		*__outP = __outBits;
+                *__outP = __outBits;
 
-		__outP++;
-		__nOut = 8;
-		__outBits = 0;
-	    }
-	}
+                __outP++;
+                __nOut = 8;
+                __outBits = 0;
+            }
+        }
 
-	if (__nOut != 8) {
-	    __outBits <<= __nOut;
+        if (__nOut != 8) {
+            __outBits <<= __nOut;
 
 #ifdef DEBUG
-	    if (__outP >= outEnd) {
-		if (@global(InfoPrinting) == true) {
-		    console_fprintf(stderr, "oops2 %d\n", __LINE__);
-		}
-		goto fail;
-	    }
+            if (__outP >= outEnd) {
+                if (@global(InfoPrinting) == true) {
+                    console_fprintf(stderr, "oops2 %d\n", __LINE__);
+                }
+                goto fail;
+            }
 #endif
-	    *__outP = __outBits;
+            *__outP = __outBits;
 
-	}
-	__outP = __nextOutRow;
+        }
+        __outP = __nextOutRow;
     }
 fail: ;
 %}.
@@ -1927,5 +1927,9 @@
 !ImageReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.95 2009-08-05 12:03:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.96 2009-11-05 14:37:53 stefan Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.96 2009-11-05 14:37:53 stefan Exp $'
 ! !