On Tue, 1 Sep 2026 18:10:21 GMT, Andy Goryachev <[email protected]> wrote:

>> John Hendrikx has updated the pull request incrementally with six additional 
>> commits since the last revision:
>> 
>>  - Remove weak reference for drawing context
>>  - Fix stroke width / dash lengths when scale != 1.0, and fix clips
>>  - Keep user set global alpha as-is
>>  - GraphicsContext#clipRect no longer clobbers existing path
>>  - Support direct buffers and slices for WritableImage#getDrawingContext
>>  - Extend tests for dirty rect, and fix dirty rect for stroked text
>
> modules/javafx.graphics/src/main/java/javafx/scene/canvas/GraphicsContext.java
>  line 1503:
> 
>> 1501:     @Override
>> 1502:     public void clipRect(double x, double y, double w, double h) {
>> 1503:         beginPath();
> 
> will this clobber the current path?
> 
> scenario: build a path, call clipRect(), call fill() -> wrong path will be 
> filled.

Yes, it would have. Fixed now.

> modules/javafx.graphics/src/main/java/javafx/scene/image/WritableImage.java 
> line 163:
> 
>> 161:     }
>> 162: 
>> 163:     private WeakReference<SWDrawingContext> drawingContextRef;
> 
> is it right to use the weak reference here?
> what happens if the gc collects the current context, will the next call to 
> getDrawingContext() return one with default paint, transform, etc.?

Yeah, this was ill conceived -- it's been a while since I wrote that, and I 
think I wanted to ensure that we're not holding on to too much resources after 
you're no longer using the drawing context.

Reevaluating this though, I think the resources used pale in comparison to a 
the likely size of the underlying pixel data of a `WritableImage`. Still good 
to do it lazy though when you use images that you manipulate directly.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1969#discussion_r3931998199
PR Review Comment: https://git.openjdk.org/jfx/pull/1969#discussion_r3931993420

Reply via email to