Re: [AD] 4.9.20

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2010-05-24 at 22:48 +1000, Peter Wang wrote:
> On 2010-05-17, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> > Probably overdue for one, so I'll make it this weekend.
> 
> * I ran into a regression on my machine.  The glyph precision fixes
> introduced artefacts, e.g. ex_color and ex_warp_mouse screenshots
> attached.  Any ideas?  This is on X11/fglrx.
> 

I'm not sure if the slider boxes in ex_color are supposed to have a 3d
effect, but if not, the attached patch makes them draw the full boxes
and also keeps the handles inside.

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>
diff --git a/examples/nihgui.cpp b/examples/nihgui.cpp
index 2527d0a..06b90a4 100644
--- a/examples/nihgui.cpp
+++ b/examples/nihgui.cpp
@@ -592,15 +592,17 @@ void VSlider::on_mouse_button_hold(int mx, int my)
 void VSlider::draw()
 {
    const Theme & theme = dialog->get_theme();
-   const int cx = (x1 + x2) / 2;
+   float left = x1 + 0.5, top = y1 + 0.5, right = x2 + 0.5,
+       bottom = y2 + 0.5;
+   const float cx = (left + right) / 2.0;
    SaveState state;
 
-   al_draw_rectangle(x1, y1, x2, y2, theme.bg, 0);
-   al_draw_line(cx, y1, cx, y2, theme.fg, 0);
+   al_draw_line(cx, top, cx, bottom, theme.fg, 1);
+   al_draw_rectangle(left, top, right, bottom, theme.bg, 1);
 
    double ratio = (double) this->cur_value / (double) this->max_value;
-   int ypos = y2 - (int) (ratio * (height() - 2));
-   al_draw_filled_rectangle(x1, ypos - 2, x2, ypos + 2, theme.fg);
+   int ypos = bottom - 0.5 - (int) (ratio * (height() - 7));
+   al_draw_filled_rectangle(left + 0.5, ypos - 5, right - 0.5, ypos, theme.fg);
 }
 
 int VSlider::get_cur_value() const


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/