RFR: 8307132: Cleanup the code of sun.java2d.cmm.lcms package
Phil Race
prr at openjdk.org
Thu May 4 16:46:22 UTC 2023
On Thu, 4 May 2023 06:15:12 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> src/java.desktop/share/native/liblcms/LCMS.c line 51:
>>
>>> 49: #define DT_BYTE sun_java2d_cmm_lcms_LCMSImageLayout_DT_BYTE
>>> 50: #define DT_SHORT sun_java2d_cmm_lcms_LCMSImageLayout_DT_SHORT
>>> 51: #define DT_INT sun_java2d_cmm_lcms_LCMSImageLayout_DT_INT
>>
>> I don't understand why this isn't a step backwards.
>> It is overloading the "size" to mean the "type"
>> How would you tell the difference between SHORT vs UNSIGNED SHORT - both 2 bytes,
>> or INT vs FLOAT - both 4 bytes ?
>> or LONG vs DOUBLE ..
>> If we ever need to, then this all needs to be reverted.
>> % cd java/lang
>> % grep BYTES *java
>> Byte.java: public static final int BYTES = SIZE / Byte.SIZE;
>> Character.java: public static final int BYTES = SIZE / Byte.SIZE;
>> Double.java: public static final int BYTES = SIZE / Byte.SIZE;
>> Float.java: public static final int BYTES = SIZE / Byte.SIZE;
>> Integer.java: public static final int BYTES = SIZE / Byte.SIZE;
>> Long.java: public static final int BYTES = SIZE / Byte.SIZE;
>> Short.java: public static final int BYTES = SIZE / Byte.SIZE;
>
> right, the idea was to use one variable to select the supported type using its size.
> Based on size we will switch what GetXXArrayElements to use. java right now supports these related functions:
>
> GetByteArrayElements,
> GetShortArrayElements,
> GetIntArrayElements,
> GetLongArrayElements,
> GetFloatArrayElements,
> GetDoubleArrayElements,
>
> The images based on long format currently are not supported by java2d and lcms. And the "float" formats are really slow in LCMS as mentioned in the description.
>
>>How would you tell the difference between SHORT vs UNSIGNED SHORT - both 2 bytes,
>
> Both will use the same code path.
>
> But I can switch this to using two different variables for type and size.
I'd prefer that.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13732#discussion_r1185263336
More information about the client-libs-dev
mailing list