GIFReader.st
changeset 1755 f61db1006d4f
parent 1745 4fa0fad2a463
child 1756 7c4f38c59b2a
--- a/GIFReader.st	Sun Apr 27 17:44:21 2003 +0200
+++ b/GIFReader.st	Mon Apr 28 11:18:06 2003 +0200
@@ -183,24 +183,24 @@
 !
 
 nextBitsPut: anInteger
-	| integer writeBitCount shiftCount |
-	shiftCount _ 0.
-	remainBitCount = 0
-		ifTrue:
-			[writeBitCount _ 8.
-			integer _ anInteger]
-		ifFalse:
-			[writeBitCount _ remainBitCount.
-			integer _ bufByte + (anInteger bitShift: 8 - remainBitCount)].
-	[writeBitCount < codeSize]
-		whileTrue:
-			[self nextBytePut: ((integer bitShift: shiftCount) bitAnd: 255).
-			shiftCount _ shiftCount - 8.
-			writeBitCount _ writeBitCount + 8].
-	(remainBitCount _ writeBitCount - codeSize) = 0
-		ifTrue: [self nextBytePut: (integer bitShift: shiftCount)]
-		ifFalse: [bufByte _ integer bitShift: shiftCount].
-	^anInteger
+        | integer writeBitCount shiftCount |
+        shiftCount := 0.
+        remainBitCount = 0
+                ifTrue:
+                        [writeBitCount := 8.
+                        integer := anInteger]
+                ifFalse:
+                        [writeBitCount := remainBitCount.
+                        integer := bufByte + (anInteger bitShift: 8 - remainBitCount)].
+        [writeBitCount < codeSize]
+                whileTrue:
+                        [self nextBytePut: ((integer bitShift: shiftCount) bitAnd: 255).
+                        shiftCount := shiftCount - 8.
+                        writeBitCount := writeBitCount + 8].
+        (remainBitCount := writeBitCount - codeSize) = 0
+                ifTrue: [self nextBytePut: (integer bitShift: shiftCount)]
+                ifFalse: [bufByte := integer bitShift: shiftCount].
+        ^anInteger
 
     "Modified: 15.10.1997 / 16:50:30 / cg"
 !
@@ -239,38 +239,40 @@
 !
 
 updatePixelPosition
-	(xpos _ xpos + 1) >= width ifFalse: [^ self].
-	xpos _ 0.
-	interlace == true
-		ifFalse: 
-			[ypos _ ypos + 1.
-			^ self].
-	pass = 0
-		ifTrue: 
-			[(ypos _ ypos + 8) >= height
-				ifTrue: 
-					[pass _ pass + 1.
-					ypos _ 4].
-			^ self].
-	pass = 1
-		ifTrue: 
-			[(ypos _ ypos + 8) >= height
-				ifTrue: 
-					[pass _ pass + 1.
-					ypos _ 2].
-			^ self].
-	pass = 2
-		ifTrue: 
-			[(ypos _ ypos + 4) >= height
-				ifTrue: 
-					[pass _ pass + 1.
-					ypos _ 1].
-			^ self].
-	pass = 3
-		ifTrue: 
-			[ypos _ ypos + 2.
-			^ self].
-	^ self error: 'can''t happen'
+    (xpos := xpos + 1) >= width ifFalse: [^ self].
+
+    xpos := 0.
+    interlace == true ifFalse:[
+        ypos := ypos + 1.
+        ^ self
+    ].
+
+    pass == 0 ifTrue:[
+        (ypos := ypos + 8) >= height ifTrue:[
+            pass := pass + 1.
+            ypos := 4
+        ].
+        ^ self
+    ].
+    pass == 1 ifTrue:[
+        (ypos := ypos + 8) >= height ifTrue:[
+            pass := pass + 1.
+            ypos := 2
+        ].
+        ^ self
+    ].
+    pass == 2 ifTrue:[
+        (ypos := ypos + 4) >= height ifTrue:[
+            pass := pass + 1.
+            ypos := 1
+        ].
+        ^ self
+    ].
+    pass == 3 ifTrue:[
+        ypos := ypos + 2.
+        ^ self
+    ].
+    ^ self error: 'can''t happen'
 
     "Modified: 14.10.1997 / 18:44:27 / cg"
 !
@@ -950,7 +952,7 @@
 writeHeaderFor:image
     "write the gif header"
 
-    |bitsPerPixel t1 n|
+    |bitsPerPixel t1|
 
     bitsPerPixel := image bitsPerPixel.
 
@@ -965,41 +967,20 @@
     outStream nextPut:0.   "/ aspect ratio
 
     0 to:(1 bitShift:bitsPerPixel)-1 do:[:pixel |
-	|clr red green blue|
+        |clr red green blue|
 
-	clr := image colorFromValue:pixel.
-	clr isNil ifTrue:[
-	    "/ unused colorMap slot
-	    red := green := blue := 0.
-	] ifFalse:[
-	    red := (clr redByte).
-	    green := (clr greenByte).
-	    blue := (clr blueByte).
-	].
-	outStream
-	    nextPut:red; nextPut:green; nextPut:blue.
+        clr := image colorFromValue:pixel.
+        clr isNil ifTrue:[
+            "/ unused colorMap slot
+            red := green := blue := 0.
+        ] ifFalse:[
+            red := (clr redByte).
+            green := (clr greenByte).
+            blue := (clr blueByte).
+        ].
+        outStream
+            nextPut:red; nextPut:green; nextPut:blue.
     ].    
-"/    n := 0.
-"/    image colorMap notNil ifTrue:[
-"/        image colorMap do:[:clr |
-"/            |red green blue|
-"/
-"/            clr isNil ifTrue:[
-"/                "/ unused colorMap slot
-"/                red := green := blue := 0.
-"/            ] ifFalse:[
-"/                red := (clr redByte).
-"/                green := (clr greenByte).
-"/                blue := (clr blueByte).
-"/            ].
-"/            outStream
-"/                nextPut:red; nextPut:green; nextPut:blue.
-"/            n := n + 1.
-"/        ]
-"/    ].
-"/    n+1 to:(1 bitShift:bitsPerPixel) do:[:i |
-"/        outStream nextPut:0; nextPut:0; nextPut:0
-"/    ].
 
     "Created: / 14.10.1997 / 17:41:28 / cg"
     "Modified: / 31.10.1997 / 16:12:13 / cg"
@@ -1022,7 +1003,7 @@
 !GIFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.81 2003-04-10 14:25:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.82 2003-04-28 09:18:06 cg Exp $'
 ! !
 
 GIFReader initialize!