Fix textures of cached components (those using setBufferedToImage) always being invalidated.

Now the textures only get invalidated when the component gets repainted.
This caused setBufferedToImage to be horribly slow when using OpenGL