oops - rgbImageBits did not update the real padding used
authorClaus Gittinger <cg@exept.de>
Tue, 30 Oct 2007 20:58:14 +0100
changeset 4813 f03cd0880bd9
parent 4812 195b0d3192ba
child 4814 4204263d3ab3
oops - rgbImageBits did not update the real padding used (icon bitmaps got broken)
Depth24Image.st
--- a/Depth24Image.st	Tue Oct 30 19:53:14 2007 +0100
+++ b/Depth24Image.st	Tue Oct 30 20:58:14 2007 +0100
@@ -1049,13 +1049,15 @@
     | bestFormat usedDeviceDepth usedDeviceBitsPerPixel usedDevicePadding form imageBits|
 
     bestFormat := self bestSupportedImageFormatFor:aDevice.
-
-    imageBits := self rgbImageBitsOn:aDevice bestFormat: bestFormat.
-
     usedDeviceDepth := bestFormat at:#depth.
     usedDeviceBitsPerPixel := bestFormat at:#bitsPerPixel.
     usedDevicePadding := bestFormat at:#padding.
 
+    imageBits := self 
+                    rgbImageBitsOn:aDevice 
+                    bestFormat: bestFormat
+                    returnUsedDevicePattingIn:[:arg | usedDevicePadding := arg].
+
     imageBits isNil ifTrue:[
         ^ self asMonochromeFormOn:aDevice
     ].
@@ -1077,12 +1079,25 @@
 
     ^ form
 
-    "Modified: / 27-05-2007 / 16:48:16 / cg"
+    "Modified: / 30-10-2007 / 20:55:35 / cg"
 !
 
 rgbImageBitsOn:aDevice bestFormat: bestFormat
     "return rgb bits from the rgb-picture."
 
+    ^ self 
+        rgbImageBitsOn:aDevice 
+        bestFormat:bestFormat 
+        returnUsedDevicePattingIn:[:usedPadding | ]
+
+    "Modified: / 30-10-2007 / 20:56:45 / cg"
+!
+
+rgbImageBitsOn:aDevice bestFormat:bestFormat returnUsedDevicePattingIn:aValueHolder
+    "return rgb bits from the rgb-picture.
+     Sorry (sigh) - this might decide to use a different padding; 
+     this information is returned in aValueHolder"
+
     |bytes usedDeviceDepth usedDeviceBitsPerPixel usedDevicePadding
      myDepth imageBits padd
      rightShiftR rightShiftG rightShiftB shiftRed shiftGreen shiftBlue|
@@ -1529,10 +1544,10 @@
         usedDeviceBitsPerPixel errorPrintCR.
         ^ nil
     ].
-
-    ^ imageBits 
-
-    "Modified: / 27-05-2007 / 16:48:16 / cg"
+    aValueHolder value:usedDevicePadding.
+    ^ imageBits
+
+    "Created: / 30-10-2007 / 20:54:53 / cg"
 ! !
 
 !Depth24Image methodsFor:'dither helpers'!
@@ -3049,5 +3064,5 @@
 !Depth24Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.88 2007-10-29 15:29:23 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.89 2007-10-30 19:58:14 cg Exp $'
 ! !