What solution (of these 2) is the fastest way to paint in graphics?
I need to max out the speed of the repainting of some widgets.
So I'm making my own widget system that only contains the things that I need so that it dont calculate unnessecary stuff.
Anyhow, these two solutions both draw same pattern, but which is fastest?
1
Code:
g.drawRect(X, Y, width, height);
g.drawLine(X+1, 20, X+width-2, 20);
2
Code:
g.drawRect(X, Y, width, height);
g.drawLine(X, 20, X+width, 20);
In number 2 I draw a line that intersects two pixels with the drawn rectangle.
In number one I remove those two pixels of intersection but at the cost of calculating a new x value twice.'
Which one is the preferred and fastest way to draw this pattern?
Re: What solution (of these 2) is the fastest way to paint in graphics?
I really don't think you're going to see a major difference in either one. But if you're worried about it, you're going to have to benchmark it for yourself within your own context.