DeviceGraphicsContext.st
changeset 7882 8b2d2f3f247d
parent 7851 002470b149b2
child 7920 522478f29bab
--- a/DeviceGraphicsContext.st	Mon Feb 13 20:01:59 2017 +0100
+++ b/DeviceGraphicsContext.st	Mon Feb 13 20:02:11 2017 +0100
@@ -1137,10 +1137,10 @@
 
 displayForm:formToDraw x:x y:y
     "draw a form or image non opaque;
-     if its a 1-plane bitmap, 1-bits are drawn in the
+     if it's a 1-plane bitmap, 1-bits are drawn in the
      current paint-color, leaving pixels with 0-bits unchanged
      (i.e. only 1-bits are drawn from the form).
-     If its a deep form (i.e. a pixmap) the current paint
+     If it's a deep form (i.e. a pixmap) the current paint
      settings are ignored and the form is drawn as-is.
      Care must be taken, that the paint color is correctly allocated
      (by sending #on: to the color) before doing so.
@@ -1153,52 +1153,53 @@
     realForm := formToDraw.
 
     transformation notNil ifTrue:[
-	pO := transformation transformPoint:x@y.
-	pX := pO x.
-	pY := pO y.
-
-	transformation isNoScale ifFalse:[
-	    w := formToDraw width.
-	    h := formToDraw height.
-	    pC := transformation applyTo:(x+w-1)@(y+h-1).
-	    nW := pC x - pX + 1.
-	    nH := pC y - pY + 1.
-	    "/ nW := (transformation applyScaleX:w) rounded.
-	    "/ nH := (transformation applyScaleY:h) rounded.
-
-	    ((nW ~= w) or:[nH ~= h]) ifTrue:[
-		"/
-		"/ hard case - someone is drawing forms with scaling in effect
-		"/ look if we have a scaled version in our pocket ...
-		"/
-		realForm := nil.
-		CachedScaledForms notNil ifTrue:[
-		    (CachedScales at:formToDraw ifAbsent:nil) = transformation scale ifTrue:[
-			realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
-		    ]
-		].
-		realForm isNil ifTrue:[
-		    "/
-		    "/ nope - must do the work ...
-		    "/
-		    realForm := formToDraw magnifiedBy:(nW / w) @ (nH / h).
-		    CachedScaledForms isNil ifTrue:[
-			CachedScaledForms := WeakIdentityDictionary new.
-			CachedScales := WeakIdentityDictionary new.
-		    ].
-		    CachedScaledForms at:formToDraw put:realForm.
-		    CachedScales at:formToDraw put:transformation scale.
-		]
-	    ]
-	]
+        pO := transformation transformPoint:x@y.
+        pX := pO x.
+        pY := pO y.
+
+        transformation isNoScale ifFalse:[
+            w := formToDraw width.
+            h := formToDraw height.
+            pC := transformation applyTo:(x+w-1)@(y+h-1).
+            nW := pC x - pX + 1.
+            nH := pC y - pY + 1.
+            "/ nW := (transformation applyScaleX:w) rounded.
+            "/ nH := (transformation applyScaleY:h) rounded.
+
+            ((nW ~= w) or:[nH ~= h]) ifTrue:[
+                "/
+                "/ hard case - someone is drawing forms with scaling in effect
+                "/ look if we have a scaled version in our pocket ...
+                "/
+                realForm := nil.
+                CachedScaledForms notNil ifTrue:[
+                    (CachedScales at:formToDraw ifAbsent:nil) = transformation scale ifTrue:[
+                        realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
+                    ]
+                ].
+                realForm isNil ifTrue:[
+                    "/
+                    "/ nope - must do the work ...
+                    "/
+                    realForm := formToDraw magnifiedBy:(nW / w) @ (nH / h).
+                    CachedScaledForms isNil ifTrue:[
+                        CachedScaledForms := WeakIdentityDictionary new.
+                        CachedScales := WeakIdentityDictionary new.
+                    ].
+                    CachedScaledForms at:formToDraw put:realForm.
+                    CachedScales at:formToDraw put:transformation scale.
+                ]
+            ]
+        ]
     ] ifFalse:[
-	pX := x.
-	pY := y.
+        pX := x.
+        pY := y.
     ].
 
     self displayDeviceForm:realForm x:pX y:pY
 
-    "Modified: 12.4.1997 / 12:47:29 / cg"
+    "Modified: / 12-04-1997 / 12:47:29 / cg"
+    "Modified (comment): / 13-02-2017 / 20:00:13 / cg"
 !
 
 displayLineFrom:p0 to:p1
@@ -1333,9 +1334,9 @@
 
 displayOpaqueForm:formToDraw x:x y:y
     "draw a form or image opaque;
-     if its a 1-plane bitmap, 1-bits are drawn in the
+     if it's a 1-plane bitmap, 1-bits are drawn in the
      current paint-color and 0-bits in the bgPaint color.
-     If its a deep form (i.e. a pixmap) the current paint/bgPaint
+     If it's a deep form (i.e. a pixmap) the current paint/bgPaint
      settings are ignored and the form drawn as-is.
      In the 1-plane case, special care must be taken if paint and/or bgPaint
      dithered colors or patterns, since are that the colors are correctly allocated
@@ -1345,64 +1346,65 @@
     |w h realForm pX pY nW nH pO pC|
 
     bgPaint isNil ifTrue:[
-	"/
-	"/ actually not an opaque draw
-	"/
-	self displayForm:formToDraw x:x y:y.
-	^ self
+        "/
+        "/ actually not an opaque draw
+        "/
+        self displayForm:formToDraw x:x y:y.
+        ^ self
     ].
 
     realForm := formToDraw.
 
     transformation notNil ifTrue:[
-	pO := transformation transformPoint:x@y.
-	pX := pO x.
-	pY := pO y.
-	"/ pX := transformation applyToX:x.
-	"/ pY := transformation applyToY:y.
-
-	transformation isNoScale ifFalse:[
-	    w := formToDraw width.
-	    h := formToDraw height.
-	    pC := transformation applyTo:(x+w-1)@(y+h-1).
-	    nW := pX - x + 1.
-	    nH := pY - y + 1.
-	    "/ nW := (transformation applyScaleX:w) rounded.
-	    "/ nH := (transformation applyScaleY:h) rounded.
-
-	    ((nW ~= w) or:[nH ~= h]) ifTrue:[
-		"/
-		"/ hard case - someone is drawing forms with scaling in effect
-		"/ look if we have a scaled version in our pocket ...
-		"/
-		realForm := nil.
-		CachedScaledForms notNil ifTrue:[
-		    (CachedScales at:formToDraw ifAbsent:nil) = transformation scale ifTrue:[
-			realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
-		    ]
-		].
-		realForm isNil ifTrue:[
-		    "/
-		    "/ nope - must do the work ...
-		    "/
-		    realForm := formToDraw magnifiedBy:(nW / w) @ (nH / h).
-		    CachedScaledForms isNil ifTrue:[
-			CachedScaledForms := WeakIdentityDictionary new.
-			CachedScales := WeakIdentityDictionary new.
-		    ].
-		    CachedScaledForms at:formToDraw put:realForm.
-		    CachedScales at:formToDraw put:transformation scale.
-		]
-	    ]
-	]
+        pO := transformation transformPoint:x@y.
+        pX := pO x.
+        pY := pO y.
+        "/ pX := transformation applyToX:x.
+        "/ pY := transformation applyToY:y.
+
+        transformation isNoScale ifFalse:[
+            w := formToDraw width.
+            h := formToDraw height.
+            pC := transformation applyTo:(x+w-1)@(y+h-1).
+            nW := pX - x + 1.
+            nH := pY - y + 1.
+            "/ nW := (transformation applyScaleX:w) rounded.
+            "/ nH := (transformation applyScaleY:h) rounded.
+
+            ((nW ~= w) or:[nH ~= h]) ifTrue:[
+                "/
+                "/ hard case - someone is drawing forms with scaling in effect
+                "/ look if we have a scaled version in our pocket ...
+                "/
+                realForm := nil.
+                CachedScaledForms notNil ifTrue:[
+                    (CachedScales at:formToDraw ifAbsent:nil) = transformation scale ifTrue:[
+                        realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
+                    ]
+                ].
+                realForm isNil ifTrue:[
+                    "/
+                    "/ nope - must do the work ...
+                    "/
+                    realForm := formToDraw magnifiedBy:(nW / w) @ (nH / h).
+                    CachedScaledForms isNil ifTrue:[
+                        CachedScaledForms := WeakIdentityDictionary new.
+                        CachedScales := WeakIdentityDictionary new.
+                    ].
+                    CachedScaledForms at:formToDraw put:realForm.
+                    CachedScales at:formToDraw put:transformation scale.
+                ]
+            ]
+        ]
     ] ifFalse:[
-	pX := x.
-	pY := y.
+        pX := x.
+        pY := y.
     ].
 
     self displayDeviceOpaqueForm:realForm x:pX y:pY
 
-    "Modified: 12.4.1997 / 12:49:02 / cg"
+    "Modified: / 12-04-1997 / 12:49:02 / cg"
+    "Modified (comment): / 13-02-2017 / 20:00:17 / cg"
 !
 
 displayOpaqueString:aString from:index1 to:index2 x:x y:y
@@ -1784,10 +1786,10 @@
 
 displayUnscaledForm:formToDraw x:x y:y
     "draw a form or image non opaque and unscaled;
-     if its a 1-plane bitmap, 1-bits are drawn in the
+     if it's a 1-plane bitmap, 1-bits are drawn in the
      current paint-color, leaving pixels with 0-bits unchanged
      (i.e. only 1-bits are drawn from the form).
-     If its a deep form (i.e. a pixmap) the current paint
+     If it's a deep form (i.e. a pixmap) the current paint
      settings are ignored and the form is drawn as-is.
      Care must be taken, that the paint color is correctly allocated
      (by sending #on: to the color) before doing so.
@@ -1799,41 +1801,43 @@
     |pX pY pO|
 
     transformation notNil ifTrue:[
-	pO := transformation transformPoint:(x@y).
-	pX := pO x.
-	pY := pO y.
+        pO := transformation transformPoint:(x@y).
+        pX := pO x.
+        pY := pO y.
     ] ifFalse:[
-	pX := x.
-	pY := y.
+        pX := x.
+        pY := y.
     ].
 
     self displayDeviceForm:formToDraw x:pX y:pY
 
-    "Modified: 12.4.1997 / 12:48:04 / cg"
+    "Modified: / 12-04-1997 / 12:48:04 / cg"
+    "Modified (comment): / 13-02-2017 / 20:00:22 / cg"
 !
 
 displayUnscaledOpaqueForm:formToDraw x:x y:y
     "draw a form or image opaque and unscaled;
-     if its a 1-plane bitmap, 1-bits are drawn in the
+     if it's a 1-plane bitmap, 1-bits are drawn in the
      current paint-color, 0 bits in background color.
-     If its a deep form (i.e. a pixmap) the current paint
+     If it's a deep form (i.e. a pixmap) the current paint
      settings are ignored and the form is drawn as-is (opaque).
      The origins coordinate is transformed, but the image itself is unscaled."
 
     |pX pY pO|
 
     transformation notNil ifTrue:[
-	pO := transformation transformPoint:(x@y).
-	pX := pO x.
-	pY := pO y.
+        pO := transformation transformPoint:(x@y).
+        pX := pO x.
+        pY := pO y.
     ] ifFalse:[
-	pX := x.
-	pY := y.
+        pX := x.
+        pY := y.
     ].
 
     self displayDeviceOpaqueForm:formToDraw x:pX y:pY
 
-    "Modified: 12.4.1997 / 12:49:21 / cg"
+    "Modified: / 12-04-1997 / 12:49:21 / cg"
+    "Modified (comment): / 13-02-2017 / 20:00:28 / cg"
 !
 
 displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y
@@ -1908,15 +1912,15 @@
 
 displayDeviceForm:aForm x:x y:y
     "draw a form or image non opaque (i.e. only foreground color is drawn);
-     If its a 1-plane bitmap, 1-bits are drawn in the
+     If it's a 1-plane bitmap, 1-bits are drawn in the
      current paint-color, leaving pixels with 0-bits unchanged
      (i.e. only 1-bits are drawn from the form).
-     If its a deep form (i.e. a pixmap) the current paint
+     If it's a deep form (i.e. a pixmap) the current paint
      settings are ignored and the form is drawn as-is;
      however, the mask is applied if present.
 
      The form should have been allocated on the same device,
-     otherwise its converted here, which slows down the draw.
+     otherwise it's converted here, which slows down the draw.
      No transformation or scaling is done.
      Care must be taken, that the paint color is correctly allocated
      (by sending #on: to the color) before doing so.
@@ -2390,6 +2394,7 @@
     device setFunction:function in:gcId.
 
     "Modified: / 27-05-2007 / 12:45:10 / cg"
+    "Modified (comment): / 13-02-2017 / 19:59:59 / cg"
 !
 
 displayDeviceLineFromX:x0 y:y0 toX:x1 y:y1
@@ -2404,9 +2409,9 @@
 
 displayDeviceOpaqueForm:aForm x:x y:y
     "draw a form or image opaque (i.e. both fg and bg is drawn);
-     If its a 1-plane bitmap, 1-bits are drawn in the
+     If it's a 1-plane bitmap, 1-bits are drawn in the
      current paint-color and 0-bits in the bgPaint color.
-     If its a deep form (i.e. a pixmap) the current paint/bgPaint
+     If it's a deep form (i.e. a pixmap) the current paint/bgPaint
      settings are ignored and the form drawn as-is.
      Any mask is ignored.
      In the 1-plane case, special care must be taken if paint and/or bgPaint
@@ -2737,7 +2742,8 @@
     foreground := nil.
     background := nil.
 
-    "Modified: 22.4.1997 / 21:44:10 / cg"
+    "Modified: / 22-04-1997 / 21:44:10 / cg"
+    "Modified (comment): / 13-02-2017 / 20:00:06 / cg"
 !
 
 displayDeviceOpaqueString:aStringArg from:index1 to:index2 in:fontArg x:x y:y