RFR: 8187759: Background not refreshed when painting over a transparent JFrame [v4]

Sergey Bylokhov serb at openjdk.org
Tue Feb 20 05:19:54 UTC 2024


On Mon, 12 Feb 2024 05:38:17 GMT, Tejesh R <tr at openjdk.org> wrote:

>> This is happening in linux where `BuffereStrategyPaintManager` is used to paint to offscreen. Here `bsg` bufferStrategy SunGraphics2D is used to paint to offscreen where the background is not refreshed, which does only clipping and then paints to offscreen. In order to handle the screen updated/clear the buffer, `setBackground` to component background color and `clearRect` against the clip area is used which solves the issue without causing any regression. 
>> CI is green for the fix and manual test is provided.
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Frame dispose moved into EDT

src/java.desktop/share/classes/javax/swing/BufferStrategyPaintManager.java line 252:

> 250:                     g2d.setBackground(paintingComponent.getBackground());
> 251:                     g2d.clearRect(x, y, w, h);
> 252:                     g2d.setBackground(oldBg);

I wonder what color should we use to clear the background? Should it be background color of the component, background color of the window, or (0,0,0)? What the Swing components usually do in that case?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17081#discussion_r1495254466


More information about the client-libs-dev mailing list