DeviceGraphicsContext.st
changeset 8315 d28a7b7f19e7
parent 8312 31d9c10d010e
child 8372 8156eaa8cf64
--- a/DeviceGraphicsContext.st	Tue Mar 20 15:58:08 2018 +0100
+++ b/DeviceGraphicsContext.st	Tue Mar 20 17:32:03 2018 +0100
@@ -1945,13 +1945,13 @@
             Logger error:'error when drawing alpha: %1' with:ex description.
         ] do:[    
             self displayDeviceFormWithAlpha:aFormOrImage x:x y:y.
-            ^ self.
         ].
         ^ self.
     ].
     self displayDeviceFormNoAlpha:aFormOrImage x:x y:y.
 
     "Modified: / 11-04-2017 / 18:29:56 / cg"
+    "Modified: / 20-03-2018 / 17:25:40 / stefan"
 !
 
 displayDeviceFormNoAlpha:aForm x:x y:y
@@ -2570,8 +2570,18 @@
 
     |id w h easy savedPaint bgForm fgForm tmpForm
      fgId bgId noColor allColor allBits dx dy
-     pX pY deviceDepth deviceForm deviceFormGCId map savForeground savBackground
-     paintClr bgPaintClr|
+     pX pY deviceDepth deviceForm deviceFormGCId map paintClr bgPaintClr|
+
+    (aFormOrImage isImage and:[aFormOrImage hasAlphaChannel]) ifTrue:[
+        "Drawing opaque with alpha-channel does not really make sense.
+         Draw non-opaque."
+        Error handle:[:ex |
+            Logger error:'error when drawing alpha: %1' with:ex description.
+        ] do:[    
+            self displayDeviceFormWithAlpha:aFormOrImage x:x y:y.
+        ].
+        ^ self.
+    ].
 
     deviceForm := aFormOrImage asFormOn:device.
     deviceForm isNil ifTrue:[
@@ -2593,7 +2603,6 @@
     gcId isNil ifTrue:[
         self initGC
     ].
-    deviceFormGCId := deviceForm initGC.
 
     w := aFormOrImage width.
     h := aFormOrImage height.
@@ -2601,6 +2610,9 @@
     pX := x rounded.
     pY := y rounded.
 
+    deviceForm isForm ifTrue:[
+        deviceFormGCId := deviceForm initGC.
+    ].
     "
      a deep form ignores paint/bgPaint settings
      and is always drawn opaque.
@@ -2899,6 +2911,7 @@
 
     "Modified: / 31-08-2017 / 19:35:55 / cg"
     "Modified: / 06-09-2017 / 12:31:45 / Maren"
+    "Modified: / 20-03-2018 / 17:27:14 / stefan"
 !
 
 displayDeviceOpaqueString:aStringArg from:index1 to:index2 in:fontArg x:x y:y