<Swing Dev> [9] Review request for 8027639: JComboBox's popup leaves tracks after closing

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu Oct 27 11:57:33 UTC 2016


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.

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.

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

-- 
Best regards, Sergey.



More information about the swing-dev mailing list