DisplaySurface.st
branchjv
changeset 7765 b8189ae681df
parent 7742 b5a20c01d46f
parent 7744 2d91d5b6cd3d
child 7773 8c70a4ba1cf2
--- a/DisplaySurface.st	Thu Dec 15 20:11:12 2016 +0000
+++ b/DisplaySurface.st	Sun Dec 18 12:12:59 2016 +0000
@@ -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,9 +1104,10 @@
 !
 
 fillDeviceRectangleWithPattern:aPixmap x:xIn y:yIn width:wIn height:hIn patternOffset:pattOffs
-    <resource: #obsolete>
     "Fill a rectangular area with some pattern.
-     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 }"
@@ -1127,8 +1130,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.
@@ -1140,8 +1143,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.
@@ -1154,8 +1157,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.
@@ -1163,7 +1166,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).
 
@@ -1189,7 +1192,7 @@
     ].
 
     oldFg notNil ifTrue:[
-        self foreground:oldFg background:oldBg.
+        gc foreground:oldFg background:oldBg.
     ].
     gc deviceClippingBoundsOrNil:oldClip.
 
@@ -1200,9 +1203,10 @@
 !
 
 fillRectangleWithPattern:aPixmap x:x y:y width:w height:h patternOffset:pattOffs
-    <resource: #obsolete>
     "Fill a rectangular area with aPixmap.
-     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|
 
@@ -2199,9 +2203,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.