#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)
--- 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
+ ].
].
"