RFR: 8329098: Support "@1x" image naming convention as fallback [v2]
Michael Strauß
mstrauss at openjdk.org
Thu Oct 17 11:47:18 UTC 2024
On Thu, 17 Oct 2024 11:23:06 GMT, Lukasz Kostyra <lkostyra at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/iio/ImageStorage.java line 392:
>>
>>> 390: try {
>>> 391: // last fallback, try to see if the file exists with @1x suffix
>>> 392: String scaled1xName = ImageTools.getScaledImageName(input, 1);
>>
>> I think this function does not properly handle cases where the input may already have a scale specified.
>>
>> If I want to load `testimg at 1x.png` then this function will return `testimg at 1x@1x.png`
>>
>> I'm not sure what is normal here, but I'd think that if a scale was already specified that we shouldn't do any fallback.
>
> This technically translates to the for-loop higher up that tries to fetch other scaled versions of an image - if you want to explicitly load `foo at 1x.png` it will look for `foo at 1x@2x.png` etc.
>
> Should we just assume that with `@Nx` provided in the name we will only load that one specific scale?
I would say so, yes. If the user specifies any `@Nx`, then we only look for this particular version.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1598#discussion_r1804615072
More information about the openjfx-dev
mailing list