checkin from browser
authorClaus Gittinger <cg@exept.de>
Wed, 15 Oct 1997 19:58:09 +0200
changeset 712 6403dd3407eb
parent 711 43df095ef760
child 713 548898fdd1dc
checkin from browser
GIFReader.st
--- a/GIFReader.st	Wed Oct 15 18:07:03 1997 +0200
+++ b/GIFReader.st	Wed Oct 15 19:58:09 1997 +0200
@@ -717,7 +717,7 @@
         pass := 0.
         xpos := 0.
         ypos := 0.
-        rowByteSize := width * 8 + 31 // 32 * 4.
+        rowByteSize := image bytesPerRow. "/ width * 8 + 31 // 32 * 4.
         remainBitCount := 0.
         bufByte := 0.
         bufStream := WriteStream on: (ByteArray new: 256).
@@ -784,7 +784,7 @@
         outStream nextPut: 0.        "zero-length packet"
         outStream nextPut: Terminator.
 
-    "Modified: 15.10.1997 / 16:49:20 / cg"
+    "Modified: 15.10.1997 / 19:56:28 / cg"
 !
 
 writeHeaderFor:image
@@ -795,22 +795,30 @@
     bitsPerPixel := image bitsPerPixel.
 
     outStream nextPutAll: 'GIF87a' asByteArray.
-    self writeShort: width. "/ screen size
-    self writeShort: height.    
+    self writeShort:width. "/ screen size
+    self writeShort:height.    
     t1 := 128.
-    t1 := t1 bitOr: (bitsPerPixel - 1 bitShift: 5).
-    t1 := t1 bitOr: bitsPerPixel - 1.
-    outStream nextPut: t1.  "/ flag
-    outStream nextPut: 0.   "/ background (not used)
-    outStream nextPut: 0.   "/ aspect ratio
+    t1 := t1 bitOr:(bitsPerPixel - 1 bitShift:5).
+    t1 := t1 bitOr:(bitsPerPixel - 1).
+    outStream nextPut:t1.  "/ flag
+    outStream nextPut:0.   "/ background (not used)
+    outStream nextPut:0.   "/ aspect ratio
 
     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: (clr redByte);
-                nextPut: (clr greenByte);
-                nextPut: (clr blueByte).
+                nextPut:red; nextPut:green; nextPut:blue.
             n := n + 1.
         ]
     ].
@@ -831,12 +839,12 @@
     outStream nextPut:t1       "/ another flag
 
     "Created: 14.10.1997 / 17:41:28 / cg"
-    "Modified: 14.10.1997 / 20:28:12 / cg"
+    "Modified: 15.10.1997 / 19:54:30 / cg"
 ! !
 
 !GIFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.58 1997-10-15 15:06:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.59 1997-10-15 17:58:09 cg Exp $'
 ! !
 GIFReader initialize!