On Sat, 5 Sep 2026 03:48:56 GMT, Michael Strauß <[email protected]> wrote:
>> John Hendrikx has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Remove whitespace
>
> modules/javafx.graphics/src/main/java/javafx/scene/image/WritableImage.java
> line 177:
>
>> 175: if (drawingContext == null) {
>> 176: // note: there is only one implementation of PlatformImage
>> (by QuantumToolkit) so the hard cast here is safe
>> 177: drawingContext = new SWDrawingContext((com.sun.prism.Image)
>> getWritablePlatformImage(), rect -> bufferDirty(rect));
>
> Multiple `WritableImage` instance can be backed by the same `PixelBuffer`,
> and `PixelBuffer.updateBuffer()` accounts for that fact by notifying all
> associated writable images.
>
> However, in this method, you're only invalidating the `WritableImage` from
> which the `DrawingContext` was obtained. This leaves all other writable
> images in a stale state.
>
> Maybe this could be solved by using the existing `PixelBuffer.updateBuffer()`
> logic if the image is backed by a `PixelBuffer`.
I made `bufferDirty` in `PixelBuffer` package private, and call that now from
`WritableImage`. Added a test as well (expanded the stubbing infra a bit for
that).
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1969#discussion_r3940435071