<Swing Dev> [9] Review request for 8027639: JComboBox's popup leaves tracks after closing
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Thu Oct 27 16:38:53 UTC 2016
On 27.10.16 19:21, Semyon Sadetsky wrote:
>>> 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?
It should not be changed. It is painted by the Window at paint() method,
which is located in the window class, which paints its own backgound.
>> 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.
As you mention above background of the window will be always cleared by
the window itself, and we can get double alpha in the background when we
blit the backbuffer to the window. What composite is used when we draw
backbuffer 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