Fixed in subclassResponsibilities in GraphicsContext. delegated_gc_jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 05 Jan 2015 01:37:58 +0100
branchdelegated_gc_jv
changeset 6729 d4608914dc99
parent 6728 9a57ec59402c
child 6730 73d56dff5532
Fixed in subclassResponsibilities in GraphicsContext. Added subclass responsibility to GraphicsContext>>copyFrom:x:y:toX:y:width:height:async: Moved DeviceGraphicsContext>>copyFrom:x:y:toX:y:width:height: to the GraphicsContext and let it call the async: variant.
DeviceGraphicsContext.st
GraphicsContext.st
--- a/DeviceGraphicsContext.st	Thu Jan 01 23:31:43 2015 +0100
+++ b/DeviceGraphicsContext.st	Mon Jan 05 01:37:58 2015 +0100
@@ -9,10 +9,10 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-'From Smalltalk/X, Version:6.2.3.0 on 23-05-2014 at 17:22:04'                   !
-
 "{ Package: 'stx:libview' }"
 
+"{ NameSpace: Smalltalk }"
+
 GraphicsContext subclass:#DeviceGraphicsContext
 	instanceVariableNames:'drawableId gcId deviceFont foreground background drawableType
 		parentId'
@@ -1127,21 +1127,6 @@
         y:dstY
 !
 
-copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
-    "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."
-
-    ^ self
-	copyFrom:aDrawable
-	x:srcX y:srcY
-	toX:dstX y:dstY
-	width:w height:h
-	async:false
-
-    "Modified: 29.1.1997 / 13:12:36 / cg"
-!
-
 copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async
     "copy from aDrawable into the receiver;
      the source may be the receiver as well - in this case its a scroll.
@@ -1303,6 +1288,7 @@
     "Modified: / 22.8.1998 / 15:15:52 / cg"
 ! !
 
+
 !DeviceGraphicsContext methodsFor:'copying'!
 
 postCopy
--- a/GraphicsContext.st	Thu Jan 01 23:31:43 2015 +0100
+++ b/GraphicsContext.st	Mon Jan 05 01:37:58 2015 +0100
@@ -1396,10 +1396,33 @@
     self copyFrom:aGC x:0 y:0 toX:dstX y:dstY width:aGC width height:aGC height
 !
 
-copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h
-    "copy from a drawable - maybe self"
+copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
+    "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."
+
+    ^ self
+	copyFrom:aDrawable
+	x:srcX y:srcY
+	toX:dstX y:dstY
+	width:w height:h
+	async:false
+
+    "Modified: 29.1.1997 / 13:12:36 / cg"
+!
+
+copyFrom:arg1 x:arg2 y:arg3 toX:arg4 y:arg5 width:arg6 height:arg7 async:arg8
+    "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."    
 
     ^ self subclassResponsibility
+
+    "Modified (comment): / 02-01-2015 / 13:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 copyFrom:aGC x:dstX y:dstY width:w height:h
@@ -2111,6 +2134,46 @@
     "Modified: / 29.1.1998 / 13:23:23 / cg"
 ! !
 
+!GraphicsContext methodsFor:'drawing in device coordinates'!
+
+displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
+    "draw a line in device coordinates"
+
+    |sav|
+
+    sav := transformation.
+    self transformation: nil.
+    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
+    self transformation: sav
+
+    "Created: / 01-01-2015 / 22:50:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+displayDeviceRectangleX:x y:y width:w height:h
+    "draw a rectangle in device coordinates"
+
+    |sav|
+
+    sav := transformation.
+    self transformation: nil.
+    self displayRectangleX:x y:y width:w height:h.
+    self transformation: sav
+
+    "Created: / 01-01-2015 / 22:51:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fillDeviceRectangleX:x y:y width:w height:h
+    "fill a rectangle with current paint color (device coordinates)"
+
+    |sav|
+
+    sav := transformation.
+    self transformation: nil.
+    self fillRectangleX:x y:y width:w height:h.
+    self transformation: sav
+
+    "Created: / 01-01-2015 / 22:51:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
 
 !GraphicsContext methodsFor:'edge drawing'!