WindowsIconReader.st
changeset 565 03b84a590f49
parent 518 c9d492fbb1b6
child 623 ea587e8fd435
--- a/WindowsIconReader.st	Thu Apr 24 21:33:14 1997 +0200
+++ b/WindowsIconReader.st	Thu Apr 24 22:10:34 1997 +0200
@@ -461,7 +461,8 @@
             aStream nextBytes:(numColor * 3) into:rawMap.
             fourBytesPerColorInfo := false.
             compression := 0.
-            dataStart := header wordAt:(16r0A + 1) MSB:false
+            "/ dataStart := header wordAt:(16r0A + 1) MSB:false.
+            dataStart := nil.
         ] ifFalse:[
             'WinIconReader [warning]: unknown format' infoPrintNL.
             ^ nil
@@ -471,9 +472,9 @@
     numColor ~~ 0 ifTrue:[
         "read the colormap"
 
-        rMap := Array new:numColor.
-        gMap := Array new:numColor.
-        bMap := Array new:numColor.
+        rMap := ByteArray new:numColor.
+        gMap := ByteArray new:numColor.
+        bMap := ByteArray new:numColor.
         srcIndex := 1.
         1 to:numColor do:[:i |
             bMap at:i put:(rawMap at:srcIndex).
@@ -513,7 +514,9 @@
         ^ nil
     ].
 
-    aStream position:(dataStart + 1).
+    dataStart notNil ifTrue:[
+        aStream position:(dataStart + 1).
+    ].
 
     inDepth == 24 ifTrue:[
         bytesPerRow := width * 3
@@ -541,7 +544,7 @@
     colorMap := Colormap redVector:rMap greenVector:gMap blueVector:bMap.
 
     "Modified: 17.9.1995 / 18:48:46 / claus"
-    "Modified: 11.4.1997 / 00:49:38 / cg"
+    "Modified: 24.4.1997 / 22:09:23 / cg"
 !
 
 fromWindowsICOFile:aFilename 
@@ -594,9 +597,9 @@
 
     rawMap := ByteArray uninitializedNew:(16*4).
     aStream nextBytes:(16*4) into:rawMap.
-    rMap := Array new:16.
-    gMap := Array new:16.
-    bMap := Array new:16.
+    rMap := ByteArray new:16.
+    gMap := ByteArray new:16.
+    bMap := ByteArray new:16.
     srcIndex := 1.
     1 to:16 do:[:i |
         bMap at:i put:(rawMap at:srcIndex).
@@ -610,6 +613,9 @@
 
     "read the data bits"
 
+    inDepth == 0 ifTrue:[
+        inDepth := 4.
+    ].
     bytesPerRow := width * inDepth + 7 // 8.
     data4 := ByteArray uninitializedNew:(height * bytesPerRow).
     aStream nextBytes:(height * bytesPerRow) into:data4.
@@ -656,12 +662,12 @@
      WindowsIconReader new fromWindowsICOFile:'/phys/clam2//LocalLibrary/Images/WIN_icons/ibm.ico'.
     "
 
-    "Modified: 15.2.1997 / 13:52:52 / cg"
+    "Modified: 24.4.1997 / 22:03:48 / cg"
 ! !
 
 !WindowsIconReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.31 1997-04-10 22:53:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.32 1997-04-24 20:10:34 cg Exp $'
 ! !
 WindowsIconReader initialize!