On 10/27/2016 2:57 PM, Sergey Bylokhov wrote:
On 27.10.16 10:51, Semyon Sadetsky wrote:
Did you check that if the rootpane background contain non-zero alpha
it does not draws twice? The first one when the the root will be draw
itself and the second time in the new code when the component will be
drawn? probably backbuffer should be initialized to Color(0,0,0,0)
instead?
Probably you've confused that root is not an instance of the JRootPane.
It is a HW container that is parent of the root pane.
But there is an another color discrepancy here. Since the HW container
is not opaque the background color should not be painted. But we fill
background to clear the updated area. Probably the fill color should be
Color(0,0,0,0) in this case but currently the getBackground() color is
used if painting is executed without back buffer (see
java.awt.Window#paint()).

When the backbuffer is disabled: The code in the Window#paint() should be executed when the Window(top level is painted). After that the child components should be painted on top of that(srcOver will be used). Note that we should not fill background of the parent when we paint a child.
It is always painted in case of non-opaque window in java.awt.Window#paint(). Are you proposing to change that?
When the backbuffer is enabled for one components or for all components, we should draw hierarchy of components one by one to the backbuffer(in one step), and then src-blit the backbuffer to the window. Or we can paint only some of components via buffer, but in this case we should clear the buffer to (0,0,0,0), draw the component, then srcover-blit to the parent. It is unclear why we should clear buffer to the parent's color when we draw a child, because the parent itself should draw this background to the backbuffer, or to the window.
Because the back buffer is used for swing components (JRootPane is back buffered) while HW container paint is not back buffered but it should contribute to the painting to get the same result as without back-buffering.
Please be more specific on your suggestions.

  Should the previous composite be restored after the rect filling?
SRC should be the default composite type.

default composite type should be srcOver, and it should be restored before call paintToOffscreen().


Reply via email to