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.
|