DisplaySurface.st
branchdelegated_gc_jv
changeset 6819 f91377f97414
parent 6800 f4acb46ba42e
parent 6771 507db14ee90a
child 6823 a46e52220d29
--- a/DisplaySurface.st	Thu Feb 19 06:21:17 2015 +0000
+++ b/DisplaySurface.st	Tue Mar 03 03:55:48 2015 +0000
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libview' }"
 
+"{ NameSpace: Smalltalk }"
+
 GraphicsMedium subclass:#DisplaySurface
 	instanceVariableNames:'viewBackground cursor eventMask moreAttributes renderer uuid
 		backed flags delegate updateRegion'
@@ -85,10 +87,6 @@
     [author:]
 	Claus Gittinger
 "
-!
-
-version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.162.2.2 2014-09-25 21:09:41 stefan Exp $'
 ! !
 
 !DisplaySurface class methodsFor:'initialization'!
@@ -460,6 +458,10 @@
 
     aCursor notNil ifTrue:[
 	(aCursor ~~ cursor) ifTrue:[
+	    "/ aCursor = Cursor wait ifTrue:[
+	    "/     Transcript showCR:'==========================='.
+	    "/     thisContext fullPrintAllOn:Transcript.
+	    "/ ].
 	    cursor := aCursor.
 	    self drawableId notNil ifTrue:[
 		self setCursor.
@@ -560,12 +562,12 @@
 
     self
 	withCursor:aCursor do:[
-            |timeToExecute remainingShowTime|
-
-            timeToExecute := Time millisecondsToRun:[ ret := aBlock value].
-            remainingShowTime := UserPreferences current waitCursorVisibleTime - timeToExecute.
-            remainingShowTime > 0 ifTrue:[
-                Delay waitForMilliseconds:remainingShowTime.
+	    |timeToExecute remainingShowTime|
+
+	    timeToExecute := Time millisecondsToRun:[ ret := aBlock value].
+	    remainingShowTime := UserPreferences current waitCursorVisibleTime - timeToExecute.
+	    remainingShowTime > 0 ifTrue:[
+		Delay waitForMilliseconds:remainingShowTime.
 	    ].
 	].
     ^ ret.
@@ -1049,22 +1051,29 @@
      redefined since GraphicsMedium fills with background
      - not viewBackground as we want here."
 
-    |pX pY pW pH currentTransformation|
+    |pX pY nW nH pO pC currentTransformation |
 
     currentTransformation := gc transformation.
     currentTransformation notNil ifTrue:[
-	pX := currentTransformation applyToX:x.
-	pY := currentTransformation applyToY:y.
-	pW := currentTransformation applyScaleX:w.
-	pH := currentTransformation applyScaleY:h.
+	pO := currentTransformation transformPoint:x@y.
+	pC := currentTransformation transformPoint:(x+w-1)@(y+h-1).
+	pX := pO x.
+	pY := pO y.
+	nW := pC x - pX + 1.
+	nH := pC y - pY + 1.
     ] ifFalse:[
 	pX := x.
 	pY := y.
-	pW := w.
-	pH := h.
+	nW := w.
+	nH := h.
     ].
 
-    ^ self clearDeviceRectangleX:pX rounded y:pY rounded width:pW rounded height:pH rounded.
+    pX := pX rounded.
+    pY := pY rounded.
+    nW := nW rounded.
+    nH := nH rounded.
+
+    ^ self clearDeviceRectangleX:pX y:pY width:nW height:nH.
 
     "Modified: / 30.10.1998 / 15:00:37 / cg"
 !
@@ -1122,7 +1131,7 @@
     xR0 := (x // pW) * pW.
     xE := x+w.
 
-    xR0 >= yE ifTrue:[^ self].
+    xR0 >= xE ifTrue:[^ self].
 
     aPixmap depth == 1 ifTrue:[
 	oldFg := self foreground.
@@ -1189,14 +1198,17 @@
      This is never invoked with X11 or Win-NT/XP/Vista systems.
      Caller must ensure that the aPixmap is really a form"
 
-    |pX pY nW nH currentTransformation|
+    |pX pY nW nH pO pC currentTransformation|
 
     currentTransformation := gc transformation.
     currentTransformation notNil ifTrue:[
-	pX := currentTransformation applyToX:x.
-	pY := currentTransformation applyToY:y.
-	nW := currentTransformation applyScaleX:w.
-	nH := currentTransformation applyScaleY:h.
+	pO := currentTransformation transformPoint:x@y.
+	pC := currentTransformation transformPoint:(x+w-1)@(y+h-1).
+	pX := pO x.
+	pY := pO y.
+	nW := pC x - pX + 1.
+	nH := pC y - pY + 1.
+
 	nW < 0 ifTrue:[
 	      nW := nW abs.
 	      pX := pX - nW.
@@ -2169,50 +2181,50 @@
 
     graphicsDevice := self graphicsDevice.
     graphicsDevice scrollsAsynchronous ifFalse:[
-        self setGotExposeFlag.
-        ^ self
+	self setGotExposeFlag.
+	^ self
     ].
 
     wg := self windowGroup.
     wg notNil ifTrue:[
-        "/
-        "/ a normal (suspendable) view.
-        "/ wait by doing a real wait
-        "/
-         wg sensor waitForExposeFor:self
+	"/
+	"/ a normal (suspendable) view.
+	"/ wait by doing a real wait
+	"/
+	 wg sensor waitForExposeFor:self
     ] ifFalse:[
-        "/
-        "/ a pure event driven view.
-        "/ wait by doing a direct dispatch loop until the event arrives.
-        "/ i.e. poll for the event
-        "/
-        graphicsDevice isWindowsPlatform ifTrue:[
-            pollDelay := 1.
-        ] ifFalse:[
-            pollDelay := 3.
-        ].
-        endPollTime := Timestamp now addSeconds:pollDelay.
-
-        [self gotExpose] whileFalse:[
-            realized ifTrue:[
-                (graphicsDevice exposeEventPendingFor:self drawableId withSync:true) ifTrue:[
-                    graphicsDevice dispatchExposeEventFor:self drawableId.
-                ].
-            ].
-            realized ifFalse:[
-                self setGotExposeFlag.
-                ^ self
-            ].
-
-            "/ break out of the poll after a while
-
-            Timestamp now > endPollTime ifTrue:[
-                'DisplaySurface [warning]: lost expose event' errorPrintCR.
-                self setGotExposeFlag.
-                ^ self
-            ].
-            Processor yield.
-        ].
+	"/
+	"/ a pure event driven view.
+	"/ wait by doing a direct dispatch loop until the event arrives.
+	"/ i.e. poll for the event
+	"/
+	graphicsDevice isWindowsPlatform ifTrue:[
+	    pollDelay := 1.
+	] ifFalse:[
+	    pollDelay := 3.
+	].
+	endPollTime := Timestamp now addSeconds:pollDelay.
+
+	[self gotExpose] whileFalse:[
+	    realized ifTrue:[
+		(graphicsDevice exposeEventPendingFor:self drawableId withSync:true) ifTrue:[
+		    graphicsDevice dispatchExposeEventFor:self drawableId.
+		].
+	    ].
+	    realized ifFalse:[
+		self setGotExposeFlag.
+		^ self
+	    ].
+
+	    "/ break out of the poll after a while
+
+	    Timestamp now > endPollTime ifTrue:[
+		'DisplaySurface [warning]: lost expose event' errorPrintCR.
+		self setGotExposeFlag.
+		^ self
+	    ].
+	    Processor yield.
+	].
     ]
 
     "Modified: / 9.1.1999 / 01:58:09 / cg"
@@ -2491,5 +2503,15 @@
     "Modified: 18.5.1996 / 15:44:33 / cg"
 ! !
 
+!DisplaySurface class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.168 2015-02-15 13:57:51 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.168 2015-02-15 13:57:51 cg Exp $'
+! !
+
 
 DisplaySurface initialize!