drawLine bug?

While coding on my LookAndFeel code, I found out that:

[code]const int w = header.getWidth();
const int h = header.getHeight();

g.drawLine (Line(Point(0,h-1),Point(w,h-1)),1);[/code]

and

[code]const int w = header.getWidth();
const int h = header.getHeight();

g.drawLine (Line(Point(0,h-1),Point(w,h-1)));[/code]

does not draw the same line. In the first example, the resulting line is exactly 2 pixels in height. In the second example it is one pixel in height.

Is this normal?

I’m curious if it still draws a 2 pixel line if you do;

g.drawLine (Line(Point(0,h-1),Point(w,h-1)),1.0f);

?

Yes, it does. Why shouldn’t it anyway? The integer 1 is being converted to 1.0f anyway…

That is actually deliberate - the one that takes a thickness draws a “correct” line, using paths, so it’s sub-pixel accurate but slow. The other one draws a quick-and-dirty 1-pixel line, which is best for integer-aligned coords.

subpixel accurate but not single-pixel accurate, eh? :wink: