I play around with colors a lot and in the trivial (and much much more frequent) case I'm constantly calling Graphics.setColor(<some instance of white>).
To prevent all the extra color.bind without implementing tests in various points of the code, I could use this:
Code:
/**
* Set the color to use when rendering to this context
*
* @param color The color to use when rendering to this context
*/
public void setColor(Color color) {
if (!color.equals(currentColor)) {
currentColor = color;
predraw();
color.bind();
postdraw();
}
}
Could be useful for everyone, couldn't it?