Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Bug in area affected by Window#clip_to
- - By Spooner Date 2010-10-01 14:43 Edited 2010-10-01 14:46
There is a problem with the Window#clip_to rectangle. The C code does
    right = x + width;
when it should be:
    right = x + width - 1;
Gosu then does:
    int physWidth = std::abs(left - right);
which means that clipped width will be one greater than requested. Similar with physHeight.

(Error found in Gosu::Graphics::beginClipping)

I found the effect in a couple of my games, but only just realised that it was almost certainly a bug in clip_to, not my code.
Parent - By Spooner Date 2010-11-13 00:23
Oh, although this post disappeared a bit, I worked out that it was not that there was an error in clip_to, but rather that draw_quad/draw_line was pretty much an approximation. You see, I was judging the clipping area by comparison with quads I was drawing, which I assumed were accurately plotted.

I ended up making a one-pixel image and scaling that to draw lines and rectangles and that was perfectly accurate. Sorry for muddying the waters a bit with my original complaint.
Up Topic Gosu / Gosu Exchange / Bug in area affected by Window#clip_to

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill