changed: #fillRectangleX:y:width:height:in: expecco_1_9_1_1
authorStefan Vogel <sv@exept.de>
Fri, 04 Mar 2011 17:09:07 +0100
changeset 5728 c3c7f362b4c3
parent 5727 d0b9ef9c0cc0
child 5729 a2d13b74741a
changed: #fillRectangleX:y:width:height:in: Now works under Linux
GradientBackground.st
--- a/GradientBackground.st	Fri Mar 04 08:58:23 2011 +0100
+++ b/GradientBackground.st	Fri Mar 04 17:09:07 2011 +0100
@@ -161,6 +161,8 @@
     b1 := color1 blueByte.
     b2 := color2 blueByte.
 
+    aView lineStyle:#solid.
+
     "/ individual lines; from top to bottom
     (direction == #northSouth or:[direction == #vertical or:[direction == nil]]) ifTrue:[
         dR := (r2 - r1) / hAll.
@@ -179,12 +181,13 @@
                 aView foreground:(Color redByte:rC greenByte:gC blueByte:bC).
                 lastR := rC. lastG := gC. lastB := bC.
             ].
-            aView displayLineFromX:x y:y+yP toX:xRight y:y+yP.
-            r := (r + dR) min:r2.
-            g := (g + dG) min:g2.
-            b := (b + dB) min:b2.
+            "xRight+1 since X11 does not show the last point of a line"
+            aView displayLineFromX:x y:y+yP toX:xRight+1 y:y+yP.
+            r := r + dR "used to do min:r2 here, but this does not work if r2 < r1 and dR is negative".
+            g := g + dG .
+            b := b + dB.
         ].
-        aView fillRectangleX:x y:hAll width:(xRight-x+1) height:(h-hAll+1).
+        aView fillRectangleX:x y:hAll-1 width:w height:(h-hAll+1).
         ^ self.
     ].
 
@@ -206,12 +209,13 @@
                 aView foreground:(Color redByte:rC greenByte:gC blueByte:bC).
                 lastR := rC. lastG := gC. lastB := bC.
             ].
-            aView displayLineFromX:x+xP y:y toX:x+xP y:yBot.
-            r := (r + dR) min:r2.
-            g := (g + dG) min:g2.
-            b := (b + dB) min:b2.
+            "yBot+1 since X11 does not show the last point of a line"
+            aView displayLineFromX:x+xP y:y toX:x+xP y:yBot+1.
+            r := r + dR.
+            g := g + dG.
+            b := b + dB.
         ].
-        aView fillRectangleX:wAll y:y width:(w-wAll+1) height:(yBot-y+1).
+        aView fillRectangleX:wAll y:y width:(w-wAll+1) height:h.
         ^ self.
     ]
 
@@ -222,5 +226,5 @@
 !GradientBackground class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.6 2011-02-03 19:31:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.7 2011-03-04 16:09:07 stefan Exp $'
 ! !