Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers [v3]

2024-01-21 Thread Martin Desruisseaux
> The `BufferedImage` Javadoc does not mention any constraint about the data > type. In practice, `BufferedImage` with floating point values can be rendered > by Java2D as well as integers, provided that a compatible `ColorModel` was > supplied at construction time. However calls to

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers [v2]

2024-01-20 Thread Sergey Bylokhov
On Sat, 20 Jan 2024 11:46:12 GMT, Martin Desruisseaux wrote: > Updated the copyright years to 2024. The pre-submit tests are failing, but I > believe that it is because the branch is 8 months old. Should I commit a > merge from master? (a test on my local machine suggests that it fixes the >

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers [v2]

2024-01-20 Thread Martin Desruisseaux
On Sat, 20 Jan 2024 10:43:49 GMT, Martin Desruisseaux wrote: >> The `BufferedImage` Javadoc does not mention any constraint about the data >> type. In practice, `BufferedImage` with floating point values can be >> rendered by Java2D as well as integers, provided that a compatible >>

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers [v2]

2024-01-20 Thread Martin Desruisseaux
> The `BufferedImage` Javadoc does not mention any constraint about the data > type. In practice, `BufferedImage` with floating point values can be rendered > by Java2D as well as integers, provided that a compatible `ColorModel` was > supplied at construction time. However calls to

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-19 Thread Sergey Bylokhov
On Thu, 4 May 2023 10:14:10 GMT, Martin Desruisseaux wrote: > The `BufferedImage` Javadoc does not mention any constraint about the data > type. In practice, `BufferedImage` with floating point values can be rendered > by Java2D as well as integers, provided that a compatible `ColorModel` was

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-19 Thread Brian Burkhalter
On Thu, 4 May 2023 10:14:10 GMT, Martin Desruisseaux wrote: > The `BufferedImage` Javadoc does not mention any constraint about the data > type. In practice, `BufferedImage` with floating point values can be rendered > by Java2D as well as integers, provided that a compatible `ColorModel` was

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-18 Thread Martin Desruisseaux
On Thu, 4 May 2023 10:14:10 GMT, Martin Desruisseaux wrote: > The `BufferedImage` Javadoc does not mention any constraint about the data > type. In practice, `BufferedImage` with floating point values can be rendered > by Java2D as well as integers, provided that a compatible `ColorModel` was

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-17 Thread Sergey Bylokhov
On Mon, 13 Nov 2023 14:53:22 GMT, Martin Desruisseaux wrote: >> The `BufferedImage` Javadoc does not mention any constraint about the data >> type. In practice, `BufferedImage` with floating point values can be >> rendered by Java2D as well as integers, provided that a compatible >>

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-17 Thread Phil Race
On Thu, 4 May 2023 10:14:10 GMT, Martin Desruisseaux wrote: > The `BufferedImage` Javadoc does not mention any constraint about the data > type. In practice, `BufferedImage` with floating point values can be rendered > by Java2D as well as integers, provided that a compatible `ColorModel` was

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-07 Thread Martin Desruisseaux
On Mon, 8 May 2023 18:44:00 GMT, Sergey Bylokhov wrote: >> I do not know why `WritableRaster.setRect(Raster)` computes intersection >> with its own code in the method body instead of delegating to >> `Rectangle.intersection(Rectangle)` in the same way as >> `BufferedImage.setData(Raster)`

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-07 Thread Martin Desruisseaux
On Thu, 9 Nov 2023 18:12:19 GMT, Sergey Bylokhov wrote: > But can we solve both issues, add optimization w/o creating the new objects? Not with the current `Rectangle` API as far as I can see. If the goal is maximal performances, the current code is likely better. The use of

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-07 Thread Martin Desruisseaux
On Thu, 4 May 2023 10:14:10 GMT, Martin Desruisseaux wrote: > The `BufferedImage` Javadoc does not mention any constraint about the data > type. In practice, `BufferedImage` with floating point values can be rendered > by Java2D as well as integers, provided that a compatible `ColorModel` was

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-07 Thread Sergey Bylokhov
On Fri, 5 May 2023 08:58:37 GMT, Martin Desruisseaux wrote: >> src/java.desktop/share/classes/java/awt/image/BufferedImage.java line 1523: >> >>> 1521: Rectangle bclip = new Rectangle(0, 0, raster.width, >>> raster.height); >>> 1522: Rectangle intersect =

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-07 Thread Sergey Bylokhov
On Tue, 7 Nov 2023 11:09:08 GMT, Martin Desruisseaux wrote: >would be replaced by the following (this code contains a call to getBounds() >overrideable method): That call could be eliminated if you create the new rect using "minX, minY, width, height". But the new code adds allocation of two

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-07 Thread Sergey Bylokhov
On Thu, 4 May 2023 10:14:10 GMT, Martin Desruisseaux wrote: > The `BufferedImage` Javadoc does not mention any constraint about the data > type. In practice, `BufferedImage` with floating point values can be rendered > by Java2D as well as integers, provided that a compatible `ColorModel` was

Re: RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-07 Thread Martin Desruisseaux
On Fri, 5 May 2023 01:10:18 GMT, Sergey Bylokhov wrote: >> The `BufferedImage` Javadoc does not mention any constraint about the data >> type. In practice, `BufferedImage` with floating point values can be >> rendered by Java2D as well as integers, provided that a compatible >> `ColorModel`

RFR: 8323108: BufferedImage.setData(Raster) should not cast float and double values to integers

2024-01-07 Thread Martin Desruisseaux
The `BufferedImage` Javadoc does not mention any constraint about the data type. In practice, `BufferedImage` with floating point values can be rendered by Java2D as well as integers, provided that a compatible `ColorModel` was supplied at construction time. However calls to `setData(Raster)`