--- a/XPMReader.st Tue Jun 06 15:07:07 2017 +0200
+++ b/XPMReader.st Mon Jun 19 19:49:17 2017 +0200
@@ -364,15 +364,15 @@
!XPMReader methodsFor:'reading'!
readImage
- "read an XPM-image from my inStream. Return the receiver
- (with all relevant instance variables set for the image)"
+ "read an XPM-image from my inStream. Return the receiver
+ (with all relevant instance variables set for the image)"
- |line
+ |line
srcIndex "{ Class: SmallInteger }"
dstIndex "{ Class: SmallInteger }"
- colorMapSize
- s bitsPerPixel bytesPerPixel
- key lastKey lastChar1 lastChar2
+ colorMapSize
+ s bitsPerPixel bytesPerPixel
+ key lastKey lastChar1 lastChar2
c1 c2 lastXLation clr|
line := inStream nextLine.
@@ -384,7 +384,7 @@
[line notNil and:[(line startsWith:'/*') or:[line isBlank or:[(line startsWith:' *')]]]] whileTrue:[
line := inStream nextLine.
].
- line notNil ifFalse:[
+ line isNil ifTrue:[
^ self fileFormatError:'format error (unexpected end of file)'.
].
((line startsWith:'static char') or:[(line startsWith:'static const char')]) ifFalse:[
@@ -392,7 +392,7 @@
].
line := inStream nextLine.
(line notNil and:[line startsWith:'/*']) ifTrue:[
- [line notNil
+ [line notNil
and:[(line startsWith:'/*') or:[line startsWith:' *']]] whileTrue:[
line := inStream nextLine.
].
@@ -483,13 +483,13 @@
bitsPerPixel == 8 ifTrue:[
data at:dstIndex put:lastXLation.
dstIndex := dstIndex + 1.
- ] ifFalse:[
+ ] ifFalse:[
bitsPerPixel == 16 ifTrue:[
data at:dstIndex put:(lastXLation bitAnd:16rFF).
data at:dstIndex+1 put:((lastXLation bitShift:-8) bitAnd:16rFF).
dstIndex := dstIndex + 2.
] ifFalse:[
- clr := colorMap at:lastXLation+1.
+ clr := colorMap at:lastXLation+1.
data at:dstIndex put:clr redByte.
data at:dstIndex+1 put:clr greenByte.
data at:dstIndex+2 put:clr blueByte.
@@ -537,6 +537,7 @@
"Modified: / 05-07-1996 / 17:27:59 / stefan"
"Modified: / 27-07-1998 / 20:01:56 / cg"
"Modified (comment): / 17-02-2017 / 08:54:06 / cg"
+ "Modified (comment): / 19-06-2017 / 19:36:39 / mawalch"
! !
!XPMReader methodsFor:'writing'!