WindowsIconReader.st
changeset 161 c47f1fd6cf5b
parent 160 ee4d64b12c94
child 172 ee7d84977c86
--- a/WindowsIconReader.st	Sun Feb 04 18:12:12 1996 +0100
+++ b/WindowsIconReader.st	Sun Feb 04 22:03:27 1996 +0100
@@ -34,7 +34,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.20 1996-02-04 17:12:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.21 1996-02-04 21:03:27 cg Exp $'
 !
 
 documentation
@@ -374,51 +374,7 @@
 	].
     ].
 
-"/    "
-"/     currently only normal (non-rle) bitmaps
-"/     supported
-"/    "
-"/    compression ~~ 0 ifTrue:[
-"/        'BMP compression type ' errorPrint. compression errorPrint.
-"/        'not supported' errorPrintNL.
-"/        ^ nil
-"/    ].
-"/    inPlanes ~~ 1 ifTrue:[
-"/        'BMP only 1 plane images supported' errorPrintNL.
-"/        ^ nil
-"/    ].
-"/
-"/    "read the data bits"
-"/
-"/    bytesPerRow := width * inDepth + 7 // 8.
-"/    data4 := ByteArray uninitializedNew:(height * bytesPerRow).
-"/
-"/    aStream position:(dataStart + 1).
-"/    aStream nextBytes:(height * bytesPerRow) into:data4.
-"/
-"/    "read mask"
-"/
-"/"
-"/    mask := ByteArray new:(width * height / 8).
-"/    aStream nextBytes:(width * height / 8) into:mask.
-"/"
-"/
-"/    "stupid: last row first"
-"/
-"/    tmp := ByteArray uninitializedNew:(height * bytesPerRow).
-"/    srcIndex := 1.
-"/    dstIndex := (height - 1) * bytesPerRow + 1.
-"/    1 to:height do:[:row |
-"/        tmp replaceFrom:dstIndex to:(dstIndex + bytesPerRow - 1)
-"/                   with:data4 startingAt:srcIndex.
-"/        srcIndex := srcIndex + bytesPerRow.
-"/        dstIndex := dstIndex - bytesPerRow.
-"/    ].
-"/    data4 := tmp.
-"/    data := ByteArray new:(width * height).
-"/    data4 expandPixels:inDepth width:width height:height
-"/                  into:data mapping:nil.
-"/
+    "/ check for valid compression
 
     compression ~~ 0 ifTrue:[
 	"/ some compression
@@ -443,24 +399,26 @@
 	^ nil
     ].
 
-    bytesPerRow := width * inDepth + 7 // 8.
-    "/ bmp data is always 32bit aligned; if required,
-    inBytesPerRow := ((bytesPerRow + 3) // 4) * 4.
     aStream position:(dataStart + 1).
 
+    inDepth == 24 ifTrue:[
+	bytesPerRow := width * 3
+    ] ifFalse:[
+	bytesPerRow := width
+    ].
     data := ByteArray uninitializedNew:(height * bytesPerRow).
-    "read & possibly decompress"
+
+    "/ read & possibly decompress
+
     (self loadBMPWidth:width height:height depth:inDepth compression:compression from:aStream into:data) ifFalse:[
 	^ nil
     ].
 
-    numColor == 0 ifTrue:[
-	inDepth == 24 ifTrue:[
-	    photometric := #rgb.
-	    samplesPerPixel := 3.
-	    bitsPerSample := #(8 8 8).
-	    ^ self
-	]
+    inDepth == 24 ifTrue:[
+	photometric := #rgb.
+	samplesPerPixel := 3.
+	bitsPerSample := #(8 8 8).
+	^ self
     ].
 
     photometric := #palette.