JDK-6764257 : D3D/OGL: color is not reset properly after save/restoreState() [RSL]
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The accelerated Decora backends call BufferedContext.saveState()/restoreStage() before and after working with the context to do its rendering.
During those calls we invalidate current context, which resets a bunch of state in the context, including validatedPaint, to null.
Unfortunately it doesn't reset isValidatedPaintAColor flag, which causes us to assume that we have some color set already.
So here's the sequence that leads to the bug:
fillRect(); // validated color == black, rgb==0xff000000, isValidatedPaintAColor==true
save state // validated color == null, rgb==0xff000000, isValidatedPaintAColor==true
drawImage() // validated color == null, validateContext calls calls resetPaint(), which effectively sets the color to white (EA=ff => color == 0xffffffff), isValidatedPaintAColor==true still
setColor(black) // so here in BufferedContext.validate() we check the new color (black) against current color (null), and since isValidatedPaintAColor is true we compare current validated RGB and find that the rgb didn't change so we don't update the color on the native level
fillRect(); // so when this fillRect is processed it is done with white
The fix is to set isValidatedPaintAColor to false when setting validatedPaint to null.