Yes I would say that is a bug. It looks like old integer code is being 
used for floating point, resulting in it rounding down multiple times.

Fixed in svn.

Peter Li wrote:
> Hi,all
>     I was using fltk2.0 r5864 on Windows.
>     I found a bug about scale transform error!
>     Can you discuss it?
> 
>     For example, next code:
> 
>     readimage(data , RGB, Rectangle(x, y, 200, 24));
>     push_matrix();
>     scale(1, 2);
>     drawimage(data, RGB, Rectangle(x, y+50, 200, 24));
>     pop_matrix();
> 
>     Now, x = 20; y = 0;
>     When I trace drawimage to void Image::draw(const fltk::Rectangle& from,
> const fltk::Rectangle& to) ,
>     I watch the Rectangle to, is: to {x_=20 y_=50 w_=200 ...} const
> fltk::Rectangle &. this is my expectant.
>     Then run to "fltk::Rectangle R; fltk::transform(to,R);", I hope
> Rectangle R is {20, 100, 200, 48}.
>     But I run into void fltk::transform(const Rectangle& from, Rectangle&
> to),
>         float w = rintf(sqrtf(d1x*d1x+d2x*d2x));      // w is 200, it is ok.
>         x = floorf(x - (w+1)/2);                       // x is 19, why? it
> is wrong.
> 
>         float h = rintf(sqrtf(d1y*d1y+d2y*d2y));        // h is 48, it is
> ok.
>         y = floorf(y - (h+1)/2);                        // y is 99, it's
> wrong.
>     So I get the R, R{x_=19 y_=99 w_=200 ...} fltk::Rectangle, it's wrong.
> 
>     Is this a bug?
> 
> 
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to