On Fri, 27 Aug 2021 13:05:24 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> Initially, this was needed when there was some level of transparency: when 
>> scrolling the old content was not cleared and you could see it at its old 
>> position.
>> 
>> For the full transparency case, this is still the case, but for translucent 
>> colors (0 < opacity < 1) I can't reproduce it anymore, so I'll modify this 
>> to apply only `if (isTransparent) { clearRect(); }`.
>> 
>> I don't see a performance drop because of this.
>
> I'm more worried about correctness than performance. Setting a clip does not 
> necessarily imply that the clipped region should be cleared. So this feels a 
> bit like a workaround for a missing `clearRect` elsewhere. I wonder if there 
> is code somewhere that assumes that if the fill color is fully transparent it 
> can skip the call to `clearRect`?

I guess the assumption might be the other way around? Since the fill color was 
not transparent, there was no need to clear the area, when rendering the same 
solid rect at the new position?

If you check this 
[comment](https://bugs.openjdk.java.net/browse/JDK-8090547?focusedCommentId=13808421&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13808421),
 there is already a mention that `WCPageBackBufferImpl::copyArea` doesn't care 
about the alpha channel.

The proposed patch: 

 texture.createGraphics().clearQuad(x+dx, y+dy, x+dx+w, y+dy+h);

 could work if we could apply it conditionally only for alpha == 0 (or maybe 
also for alpha < 1).

My current approach with `clearRect` ultimately calls `clearQuad`, so both 
might be doing the same after all.

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

PR: https://git.openjdk.java.net/jfx/pull/563

Reply via email to