#BUGFIX by cg
class: DisplaySurface
changed:
#clearDeviceRectangleX:y:width:height:
#waitForExpose
poll times reduced
#fillDeviceRectangleWithPattern:x:y:width:height:patternOffset:
#fillRectangleWithPattern:x:y:width:height:patternOffset:
not obsolete; XQuartz seems to have a bug when doing
pixmap fills with offset.
--- a/DisplaySurface.st Tue Dec 13 11:40:50 2016 +0100
+++ b/DisplaySurface.st Fri Dec 16 13:37:31 2016 +0100
@@ -1028,6 +1028,8 @@
|oldPaint org patternOffsetX patternOffsetY|
+ (w <= 0 or:[h <= 0]) ifTrue:[^ self].
+
gc isNil ifTrue:[
"nothing to clear"
^ self.
@@ -1038,7 +1040,7 @@
viewBackground isViewBackground ifTrue:[
oldPaint := self paint.
self
- paint:self background;
+ paint:gc background;
fillDeviceRectangleX:x y:y width:w height:h;
paint:oldPaint.
viewBackground fillRectangleX:x y:y width:w height:h in:self.
@@ -1102,11 +1104,12 @@
!
fillDeviceRectangleWithPattern:aPixmap x:xIn y:yIn width:wIn height:hIn patternOffset:pattOffs
- <resource: #obsolete>
"fill a rectangular area with some pattern.
A helper for devices which do not support pixmap drawing (i.e. win95).
This is never invoked with X11 or Win-NT/XP/Vista systems.
- Caller must ensure that aPixmap is really a form"
+ Caller must ensure that aPixmap is really a form.
+ CG: mhm it seems that XQuartz has a bug and also has problems doing this.
+ therefore it is actually not obsolete."
|r b
pW "{ Class: SmallInteger }"
@@ -1129,8 +1132,8 @@
x := x max:0.
y := y max:0.
- r := (xIn + w - 1) min:(width - 1).
- b := (yIn + h - 1) min:(height - 1).
+ r := (xIn + w) min:width.
+ b := (yIn + h) min:height.
pW := aPixmap width.
pH := aPixmap height.
@@ -1142,8 +1145,8 @@
r := r min:oldClip right.
b := b min:oldClip bottom.
].
- w := r-x+1.
- h := b-y+1.
+ w := r-x.
+ h := b-y.
yR := (y // pH) * pH.
yE := y+h.
@@ -1156,8 +1159,8 @@
xR0 >= xE ifTrue:[^ self].
aPixmap depth == 1 ifTrue:[
- oldFg := self foreground.
- oldBg := self background.
+ oldFg := gc foreground.
+ oldBg := gc background.
(clrMap := aPixmap colorMap) notNil ifTrue:[
bg := clrMap at:1.
fg := clrMap at:2.
@@ -1165,7 +1168,7 @@
bg := self whiteColor.
fg := self blackColor.
].
- self foreground:fg background:bg.
+ gc foreground:fg background:bg.
].
self deviceClippingBounds:(Rectangle left:x top:y width:w height:h).
@@ -1191,7 +1194,7 @@
].
oldFg notNil ifTrue:[
- self foreground:oldFg background:oldBg.
+ gc foreground:oldFg background:oldBg.
].
self deviceClippingBounds:oldClip.
@@ -1201,33 +1204,34 @@
!
fillRectangleWithPattern:aPixmap x:x y:y width:w height:h patternOffset:pattOffs
- <resource: #obsolete>
"fill a rectangular area with aPixmap.
A helper for devices which do not support pixmap filling (i.e. win95 screens).
This is never invoked with X11 or Win-NT/XP/Vista systems.
- Caller must ensure that the aPixmap is really a form"
+ Caller must ensure that the aPixmap is really a form.
+ CG: mhm it seems that XQuartz has a bug and also has problems doing this.
+ therefore it is actually not obsolete."
|pX pY nW nH currentTransformation|
currentTransformation := gc transformation.
currentTransformation notNil ifTrue:[
- pX := currentTransformation applyToX:x.
- pY := currentTransformation applyToY:y.
- nW := currentTransformation applyScaleX:w.
- nH := currentTransformation applyScaleY:h.
- nW < 0 ifTrue:[
- nW := nW abs.
- pX := pX - nW.
- ].
- nH < 0 ifTrue:[
- nH := nH abs.
- pY := pY - nH.
- ].
+ pX := currentTransformation applyToX:x.
+ pY := currentTransformation applyToY:y.
+ nW := currentTransformation applyScaleX:w.
+ nH := currentTransformation applyScaleY:h.
+ nW < 0 ifTrue:[
+ nW := nW abs.
+ pX := pX - nW.
+ ].
+ nH < 0 ifTrue:[
+ nH := nH abs.
+ pY := pY - nH.
+ ].
] ifFalse:[
- pX := x.
- pY := y.
- nW := w.
- nH := h.
+ pX := x.
+ pY := y.
+ nW := w.
+ nH := h.
].
pX := pX rounded.
pY := pY rounded.
@@ -1235,9 +1239,9 @@
nH := nH rounded.
self
- fillDeviceRectangleWithPattern:aPixmap
- x:pX y:pY width:nW height:nH
- patternOffset:pattOffs
+ fillDeviceRectangleWithPattern:aPixmap
+ x:pX y:pY width:nW height:nH
+ patternOffset:pattOffs
"Modified: 4.6.1996 / 17:58:49 / cg"
!
@@ -2202,9 +2206,9 @@
"/ i.e. poll for the event
"/
device isWindowsPlatform ifTrue:[
- pollDelay := 1.
+ pollDelay := 0.5.
] ifFalse:[
- pollDelay := 3.
+ pollDelay := 1.
].
endPollTime := Timestamp now addSeconds:pollDelay.