Always send #transformation: when transfromation object is modified. delegated_gc_jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 01 Jan 2015 23:31:43 +0100
branchdelegated_gc_jv
changeset 6728 9a57ec59402c
parent 6727 f3449322bf47
child 6729 d4608914dc99
Always send #transformation: when transfromation object is modified. This allow for subclasses to add a custom code that handles transfromation change in a single method.
GraphicsContext.st
--- a/GraphicsContext.st	Fri Dec 26 22:52:58 2014 +0100
+++ b/GraphicsContext.st	Thu Jan 01 23:31:43 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 25-03-2014 at 11:57:17'                   !
-
 "{ Package: 'stx:libview' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#GraphicsContext
 	instanceVariableNames:'device paint bgPaint function font lineStyle lineWidth joinStyle
 		capStyle mask maskOrigin transformation clipRect
@@ -1079,15 +1079,18 @@
 
 scale:aPoint
     "set the scale factor of the transformation"
-
-    transformation isNil ifTrue:[
-	aPoint = 1 ifTrue:[^ self].
-	transformation := WindowingTransformation scale:aPoint translation:0
+    | t |
+
+    (t := transformation) isNil ifTrue:[
+        aPoint = 1 ifTrue:[^ self].
+        t := WindowingTransformation scale:aPoint translation:0.
     ] ifFalse:[
-	transformation scale:aPoint.
-    ]
-
-    "Modified: 27.4.1996 / 18:47:38 / cg"
+        t scale:aPoint.
+    ].
+    self transformation: t.
+
+    "Modified: / 27-04-1996 / 18:47:38 / cg"
+    "Modified: / 01-01-2015 / 23:29:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 transformation 
@@ -1104,15 +1107,18 @@
 
 translateBy:aPoint
     "add to the translation offset of the transformation"
-
-    transformation isNil ifTrue:[
-	aPoint = 0 ifTrue:[^ self].
-	transformation := WindowingTransformation scale:1 translation:aPoint
+    | t |
+
+    (t := transformation) isNil ifTrue:[
+        aPoint = 0 ifTrue:[^ self].
+        t:= WindowingTransformation scale:1 translation:aPoint.
     ] ifFalse:[
-	transformation translateBy:aPoint
-    ]
-
-    "Created: 10.2.1997 / 13:50:22 / cg"
+        t translateBy:aPoint.
+    ].
+    self transformation: t
+
+    "Created: / 10-02-1997 / 13:50:22 / cg"
+    "Modified: / 01-01-2015 / 23:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 translation
@@ -1126,15 +1132,19 @@
 
 translation:aPoint
     "set the translation offset of the transformation"
-
-    transformation isNil ifTrue:[
-	aPoint = 0 ifTrue:[^ self].
-	transformation := WindowingTransformation scale:1 translation:aPoint
+    | t |
+
+
+    (t := transformation) isNil ifTrue:[
+        aPoint = 0 ifTrue:[^ self].
+        t := WindowingTransformation scale:1 translation:aPoint
     ] ifFalse:[
-	transformation translation:aPoint.
-    ]
-
-    "Created: 27.4.1996 / 18:47:28 / cg"
+        t translation:aPoint.
+    ].
+    self transformation: t
+
+    "Created: / 27-04-1996 / 18:47:28 / cg"
+    "Modified: / 01-01-2015 / 23:29:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GraphicsContext methodsFor:'backward compatibility'!
@@ -2101,40 +2111,6 @@
     "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.
-    transformation := nil.
-    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
-    transformation := sav
-!
-
-displayDeviceRectangleX:x y:y width:w height:h
-    "draw a rectangle in device coordinates"
-
-    |sav|
-
-    sav := transformation.
-    transformation := nil.
-    self displayRectangleX:x y:y width:w height:h.
-    transformation := sav
-!
-
-fillDeviceRectangleX:x y:y width:w height:h
-    "fill a rectangle with current paint color (device coordinates)"
-
-    |sav|
-
-    sav := transformation.
-    transformation := nil.
-    self fillRectangleX:x y:y width:w height:h.
-    transformation := sav
-! !
 
 !GraphicsContext methodsFor:'edge drawing'!
 
@@ -2550,6 +2526,11 @@
 
 version_CVS
     ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.137 2014-07-08 21:21:04 cg Exp $'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 ! !