DeviceGraphicsContext.st
changeset 7749 f4ad7601ae41
parent 7746 7ad93b0b1545
child 7752 81c84fab0aac
--- a/DeviceGraphicsContext.st	Fri Dec 16 14:37:58 2016 +0100
+++ b/DeviceGraphicsContext.st	Fri Dec 16 15:51:12 2016 +0100
@@ -949,11 +949,7 @@
 copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h depth:depth
     "copy from aDrawable into the receiver;
      the source may be the receiver as well - in this case its a scroll.
-     All coordinates are in device coordinates.
-     If the receiver is a view AND async is true, the call returns immediately
-     - otherwise, it returns when the scroll operation is finished.
-     (not all devices care for this).
-     If the receiver is a pixmap, the call always returns immediately."
+     All coordinates are in device coordinates."
 
     |srcGCId srcDrawableId|
 
@@ -961,11 +957,7 @@
         self initGC
     ].
 
-    srcGCId := aGC gcId.
-    srcGCId isNil ifTrue:[
-        aGC initGC.
-        srcGCId := aGC gcId.
-    ].    
+    srcGCId := aGC initGC.
     srcDrawableId := aGC drawableId.
 
     ((depth == 1) and:[device depth ~~ 1]) ifTrue:[
@@ -1036,8 +1028,7 @@
         self initGC
     ].
 
-    aGC initGC.
-    srcGCId := aGC gcId.
+    srcGCId := aGC initGC.
     srcDrawableId := aGC drawableId.
 
     aGC isPixmap ifTrue:[
@@ -1962,10 +1953,7 @@
     ].
     "/ device needGCForBitmapSource  - i.e. WIN32
     device isWindowsPlatform ifTrue:[
-        (deviceFormGCId := deviceForm gcId) isNil ifTrue:[
-            deviceForm initGC.
-            deviceFormGCId := deviceForm gcId.
-        ]
+        deviceFormGCId := deviceForm initGC.
     ].
 
     "
@@ -2427,7 +2415,7 @@
 
     |id w h easy savedPaint bgForm fgForm tmpForm
      fgId bgId noColor allColor allBits dx dy
-     pX pY deviceDepth deviceForm map|
+     pX pY deviceDepth deviceForm deviceFormGCId map|
 
     deviceForm := aForm asFormOn:device.
     id := deviceForm drawableId.
@@ -2446,7 +2434,7 @@
     gcId isNil ifTrue:[
         self initGC
     ].
-    deviceForm gcId isNil ifTrue:[deviceForm initGC].
+    deviceFormGCId := deviceForm initGC.
 
     w := aForm width.
     h := aForm height.
@@ -2463,7 +2451,7 @@
             copyFromPixmapId:id
             x:0
             y:0
-            gc:deviceForm gcId
+            gc:deviceFormGCId
             to:drawableId
             x:pX
             y:pY
@@ -2525,7 +2513,7 @@
             copyPlaneFromPixmapId:id
             x:0
             y:0
-            gc:(deviceForm gcId)
+            gc:deviceFormGCId
             to:drawableId
             x:pX
             y:pY
@@ -2566,7 +2554,7 @@
                 copyPlaneFromPixmapId:id
                 x:0
                 y:0
-                gc:(deviceForm gcId)
+                gc:deviceFormGCId
                 to:drawableId
                 x:pX
                 y:pY
@@ -2585,7 +2573,7 @@
                 copyPlaneFromPixmapId:id
                 x:0
                 y:0
-                gc:(deviceForm gcId)
+                gc:deviceFormGCId
                 to:drawableId
                 x:pX
                 y:pY
@@ -2623,7 +2611,7 @@
                 copyPlaneFromPixmapId:id
                 x:0
                 y:0
-                gc:(deviceForm gcId)
+                gc:deviceFormGCId
                 to:drawableId
                 x:pX
                 y:pY
@@ -2642,7 +2630,7 @@
                 copyPlaneFromPixmapId:id
                 x:0
                 y:0
-                gc:(deviceForm gcId)
+                gc:deviceFormGCId
                 to:drawableId
                 x:pX
                 y:pY
@@ -3483,13 +3471,14 @@
 initGC
     "since we do not need a gc-object for the drawable until something is
      really drawn, none is created.
-     This method is sent, when the first drawing happens"
+     This method is sent, when the first drawing happens.
+     Answer the gcId."
 
     |fgId bgId p fontId|
 
     gcId notNil ifTrue:[
         "already initialized"
-        ^ self
+        ^ gcId
     ].
     drawableId isNil ifTrue:[
         "/
@@ -3580,6 +3569,7 @@
         deviceFont := font.
         device setFont:fontId in:gcId
     ].
+    ^ gcId.
 
     "Modified: / 22-10-2006 / 14:10:53 / cg"
 !