The reason I ask is this :-
The current rendering code for a VolatileImage is something like this… (taken from Suns example code)
do {
int returnCode = vImg.validate(getGraphicsConfiguration());
if (returnCode == VolatileImage.IMAGE_RESTORED) {
// Contents need to be restored
renderOffscreen(); // restore contents
} else if (returnCode == VolatileImage.IMAGE_INCOMPATIBLE) {
// old vImg doesn't work with new GraphicsConfig; re-create it
vImg = createVolatileImage(w, h);
renderOffscreen();
}
gScreen.drawImage(vImg, 0, 0, this);
} while (vImg.contentsLost());
This code works fine, however it does not prevent a valid image from being drawn multiple times. The chain of events would look something like this…
- validate image
- draw image
- image then loses its contents
- image contents lost is checked (and returns true)
- revalidate image
- draw image
- etc etc
assuming the loop doesn’t go on forever… (which I only assume isn’t possible because its never happened :P)
it is not impossible that an image in a valid state may be drawn twice.
For images with OPAQUE or BITMASK transparency repeat drawing has no adverse effect, however for an image with an alpha channel (where both the src and dst contribute to the dst pixel) it is possible the resultant pixels will be in an invalid state.
ofcourse, this problem only effects VolatileImages if they ever support transparency… but if they never do support transparency, it begs the question…
Will we ever get accelerated images that we can monitor ourselfs that support transparency? (rather than the hidden acceleration that occurs with auto images)