#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Tue, 31 May 2016 15:21:21 +0200
changeset 3689 c12d825e0249
parent 3688 10011de73077
child 3690 77cd7b816025
child 3691 f0cdcbd903e0
#REFACTORING by cg class: GIFReader changed: #assignTransparentPixelIn:
GIFReader.st
--- a/GIFReader.st	Tue May 31 15:15:03 2016 +0200
+++ b/GIFReader.st	Tue May 31 15:21:21 2016 +0200
@@ -668,24 +668,26 @@
 assignTransparentPixelIn:image
     "find an usused pixelValue in the colorMap (or image)."
 
-    |cmap usedPixelValues unusedValues|
+    |cmap cmapSize imgDepth usedPixelValues unusedValues|
 
-    (cmap := image colorMap) size > 0 ifTrue:[
-	cmap size < 256 ifTrue:[
-	    maskPixel := cmap size.
-	    ^ self
-	]
+    cmap := image colorMap.
+    cmapSize := cmap size.
+    ((cmapSize > 0) and:[cmapSize < 256]) ifTrue:[
+        maskPixel := cmapSize.
+        ^ self
     ].
+    
     image compressColorMap.
+    imgDepth := image depth.
     usedPixelValues := image usedValues.
-    usedPixelValues size < (1 bitShift:image depth) ifFalse:[
-	Image informationLostQuerySignal
-	    raiseRequestWith:image
-	    errorString:('GIF writer cannot assign a transparent pixel - all pixelValues used by image').
+    usedPixelValues size < (1 bitShift:imgDepth) ifFalse:[
+        Image informationLostQuerySignal
+            raiseRequestWith:image
+            errorString:('GIF writer cannot assign a transparent pixel - all pixelValues used by image').
     ].
 
     "/ there must be an unused pixelValue
-    unusedValues := (0 to:(1 bitShift:image depth)-1) asSet.
+    unusedValues := (0 to:(1 bitShift:imgDepth)-1) asSet.
     unusedValues removeAll:usedPixelValues.
 
     maskPixel := unusedValues first.