JDK-6764257 : D3D/OGL: color is not reset properly after save/restoreState() [RSL]
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-10-27
  • Updated: 2010-07-09
  • Resolved: 2009-01-09
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.

To download the current JDK release, click here.
JDK 6 JDK 7
6u18Fixed 7 b43Fixed
Description
In some cases the rendering color is not propely reset after BufferedContext.save/restoreState().

Comments
SUGGESTED FIX http://hg.openjdk.java.net/jdk7/2d/jdk/rev/594c52582b21
28-10-2008

EVALUATION 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: setColor(black) fillRect(); // validated color == black, rgb==0xff000000, isValidatedPaintAColor==true save state // validated color == null, rgb==0xff000000, isValidatedPaintAColor==true restore state 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.
27-10-2008