.
authorclaus
Wed, 03 May 1995 02:02:53 +0200
changeset 64 ea02b0bdc674
parent 63 23617db5f7db
child 65 1a3b293f8dc0
.
GIFReader.st
--- a/GIFReader.st	Wed May 03 02:01:17 1995 +0200
+++ b/GIFReader.st	Wed May 03 02:02:53 1995 +0200
@@ -23,7 +23,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.13 1995-02-18 15:57:13 claus Exp $
+$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.14 1995-05-03 00:02:53 claus Exp $
 '!
 
 !GIFReader class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.13 1995-02-18 15:57:13 claus Exp $
+$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.14 1995-05-03 00:02:53 claus Exp $
 "
 !
 
@@ -105,13 +105,16 @@
 readColorMap:colorMapSize
     "get gif colormap consisting of colorMapSize entries"
 
+    |sz "{ Class: SmallInteger }"|
+
 "/    redMap := Array new:colorMapSize.
 "/    greenMap := Array new:colorMapSize.
 "/    blueMap := Array new:colorMapSize.
     redMap := ByteArray uninitializedNew:colorMapSize.
     greenMap := ByteArray uninitializedNew:colorMapSize.
     blueMap := ByteArray uninitializedNew:colorMapSize.
-    1 to:colorMapSize do:[:i |
+    sz := colorMapSize.
+    1 to:sz do:[:i |
 	redMap at:i put:(inStream nextByte).
 	greenMap at:i put:(inStream nextByte).
 	blueMap at:i put:(inStream nextByte)
@@ -146,7 +149,8 @@
      hasColorMap hasLocalColorMap interlaced id
      leftOffs topOffs codeLen
      compressedData compressedSize
-     tmp srcOffset dstOffset|
+     tmp srcOffset dstOffset
+     h "{ Class: SmallInteger }"|
 
     inStream := aStream.
     aStream binary.
@@ -242,7 +246,8 @@
     ].
     compressedSize := index - 1.
 
-    data := ByteArray new:((width + 1) * (height + 1)).
+    h := height.
+    data := ByteArray new:((width + 1) * (h + 1)).
     'GIFReader: decompressing ...' errorPrintNL.
 
     self class decompressGIFFrom:compressedData
@@ -258,7 +263,7 @@
         "phase 1: 0, 8, 16, 24, ..."
 
         srcOffset := 1.
-        0 to:(height - 1) by:8 do:[:dstRow |
+        0 to:(h - 1) by:8 do:[:dstRow |
             dstOffset := dstRow * width + 1.
             tmp replaceFrom:dstOffset to:(dstOffset + width - 1)
                        with:data startingAt:srcOffset.
@@ -267,7 +272,7 @@
 
         "phase 2: 4, 12, 20, 28, ..."
 
-        4 to:(height - 1) by:8 do:[:dstRow |
+        4 to:(h - 1) by:8 do:[:dstRow |
             dstOffset := dstRow * width + 1.
             tmp replaceFrom:dstOffset to:(dstOffset + width - 1)
                        with:data startingAt:srcOffset.
@@ -276,7 +281,7 @@
 
         "phase 3: 2, 6, 10, 14, ..."
 
-        2 to:(height - 1) by:4 do:[:dstRow |
+        2 to:(h - 1) by:4 do:[:dstRow |
             dstOffset := dstRow * width + 1.
             tmp replaceFrom:dstOffset to:(dstOffset + width - 1)
                        with:data startingAt:srcOffset.
@@ -285,7 +290,7 @@
 
         "phase 4: 1, 3, 5, 7, ..."
 
-        1 to:(height - 1) by:2 do:[:dstRow |
+        1 to:(h - 1) by:2 do:[:dstRow |
             dstOffset := dstRow * width + 1.
             tmp replaceFrom:dstOffset to:(dstOffset + width - 1)
                        with:data startingAt:srcOffset.