DisplaySurface.st
changeset 1236 ad9f2cefaa95
parent 1216 c01819586102
child 1245 4a4e15a3e4fd
--- a/DisplaySurface.st	Thu Jan 16 23:24:57 1997 +0100
+++ b/DisplaySurface.st	Thu Jan 16 23:53:57 1997 +0100
@@ -101,7 +101,8 @@
 setViewBackground
     "install the viewBackground for the receiver on the device"
 
-    |id devBgPixmap bgPixmap w h colors|
+    |id devBgPixmap bgPixmap w h colorMap 
+     pixmapDepth deviceDepth|
 
     drawableId notNil ifTrue:[
         viewBackground isColor ifTrue:[
@@ -139,30 +140,35 @@
         w := bgPixmap width.
         h := bgPixmap height.
 
-        (bgPixmap depth ~~ device depth) ifTrue:[
-            (bgPixmap depth ~~ 1) ifTrue:[
-                self error:'bad dither depth'.
+        deviceDepth := device depth.
+        pixmapDepth := bgPixmap depth.
+
+        (pixmapDepth ~~ deviceDepth) ifTrue:[
+            (pixmapDepth ~~ 1) ifTrue:[
+                self error:'bad dither depth (must be one or devices depth)'.
                 ^ self
             ].
+
             "
              convert it into a deep form
             "
-            colors := bgPixmap colorMap.
-            devBgPixmap := Form width:w height:h depth:(device depth) on:device.
-            devBgPixmap paint:(colors at:1).
+            colorMap := bgPixmap colorMap.
+            devBgPixmap := Form width:w height:h depth:deviceDepth on:device.
+            devBgPixmap paint:(colorMap at:1).
             devBgPixmap fillRectangleX:0 y:0 width:w height:h.
-            devBgPixmap foreground:(colors at:2) background:(colors at:1).
+            devBgPixmap foreground:(colorMap at:2) background:(colorMap at:1).
             devBgPixmap copyPlaneFrom:bgPixmap x:0 y:0 toX:0 y:0 width:w height:h.
             bgPixmap := devBgPixmap.
         ] ifFalse:[
-            (bgPixmap depth == 1) ifTrue:[
+            (pixmapDepth == 1) ifTrue:[
                 "
                  although depth matches,
                  values in the dither are to be interpreted via the ditherForms
                  colormap, which is not always the same as blackpixel/whitepixel ...
                 "
-                (bgPixmap colorMap at:1) colorId == device whitepixel ifTrue:[
-                    (bgPixmap colorMap at:2) colorId == device blackpixel ifTrue:[
+                colorMap := bgPixmap colorMap.
+                (colorMap at:1) colorId == device whitepixel ifTrue:[
+                    (colorMap at:2) colorId == device blackpixel ifTrue:[
                         "
                          ok, can use it
                         "
@@ -174,8 +180,8 @@
                 "
                  no, must invert it
                 "
-                devBgPixmap := Form width:w height:h depth:(device depth) on:device.
-                devBgPixmap paint:(bgPixmap colorMap at:2) on:(bgPixmap colorMap at:1).
+                devBgPixmap := Form width:w height:h depth:deviceDepth on:device.
+                devBgPixmap paint:(colorMap at:2) on:(colorMap at:1).
                 devBgPixmap copyPlaneFrom:bgPixmap x:0 y:0 toX:0 y:0 width:w height:h.
                 bgPixmap := devBgPixmap.
             ]
@@ -183,7 +189,7 @@
         device setWindowBackgroundPixmap:(bgPixmap id) in:drawableId.
     ]
 
-    "Modified: 10.1.1997 / 17:48:55 / cg"
+    "Modified: 16.1.1997 / 23:53:45 / cg"
 !
 
 viewBackground
@@ -1756,5 +1762,5 @@
 !DisplaySurface class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.16 1997-01-14 14:43:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.17 1997-01-16 22:53:57 cg Exp $'
 ! !