United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6764257 D3D/OGL: color is not reset properly after save/restoreState() [RSL]
JDK-6764257 : D3D/OGL: color is not reset properly after save/restoreState() [RSL]

Details
Type:
Bug
Submit Date:
2008-10-27
Status:
Resolved
Updated Date:
2010-07-09
Project Name:
JDK
Resolved Date:
2009-01-09
Component:
client-libs
OS:
windows_xp
Sub-Component:
2d
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
In some cases the rendering color is not propely reset after BufferedContext.save/restoreState().

                                    

Comments
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.
                                     
2008-10-27
SUGGESTED FIX

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



Hardware and Software, Engineered to Work Together