#UI_ENHANCEMENT jv
authorClaus Gittinger <cg@exept.de>
Fri, 09 Oct 2015 18:18:17 +0200
branchjv
changeset 7027 35ce7924300f
parent 7026 9bcc83f3493d
child 7028 f6289e1ef06e
#UI_ENHANCEMENT class: DisplaySurface changed: #clearDeviceRectangleX:y:width:height: hack for devices which can fill with a pattern, but only if the mask offset is 0 (XQuartz seems to have a bug there) (grafted from a32d62ad31cdf24a73c60866646218036a4fc1b8)
DisplaySurface.st
--- a/DisplaySurface.st	Fri Oct 09 18:13:29 2015 +0200
+++ b/DisplaySurface.st	Fri Oct 09 18:18:17 2015 +0200
@@ -1018,7 +1018,7 @@
      redefined since GraphicsMedium fills with background
      - not viewBackground as we want here."
 
-    |oldPaint|
+    |oldPaint org patternOffsetX patternOffsetY|
 
     viewBackground isColor ifFalse:[
 	viewBackground isViewBackground ifTrue:[
@@ -1030,13 +1030,25 @@
 	    ^ self.
 	].
 
-	gc notNil ifTrue:[
-	    self maskOrigin:self viewOrigin negated.
-	    (gc graphicsDevice supportsMaskedDrawingWith:viewBackground) ifFalse:[
-		gc graphicsDevice fillDeviceRectangleWithViewBackgroundX:x y:y width:w height:h.
-		^ self.
-	    ].
-	].
+        (self device supportsMaskedDrawingWith:viewBackground) ifFalse:[
+            "/ hand-fill: the device cannot draw with a bitmap pattern underneath.
+            self fillDeviceRectangleWithViewBackgroundX:x y:y width:w height:h.
+            ^ self.
+        ].
+        
+        gc notNil ifTrue:[
+            org := self viewOrigin.
+            patternOffsetX := (org x rounded \\ viewBackground width).
+            patternOffsetY := (org y rounded \\ viewBackground height).
+            (patternOffsetX ~= 0 or:[patternOffsetY ~= 0]) ifTrue:[
+                (self device supportsMaskedDrawingWithOffset:viewBackground) ifFalse:[
+                    "/ hand-fill: the device cannot draw with a shifted bitmap pattern underneath.
+                    self fillDeviceRectangleWithViewBackgroundX:x y:y width:w height:h.
+                    ^ self.
+                ].
+            ].    
+            self device setMaskOriginX:patternOffsetX negated y:patternOffsetY negated in:self gcId
+        ].
     ].
 
     "