Hi Sergey, << Is it fine that we pass "-1" to the "adjustWidthHeight"? I am not sure that it is ready for the negative values(where it calculates proportions). Note that prepareImage() expects only positive or "-1". <<Should not we update the "WIDTH_FLAG | HEIGHT_FLAG" only if the newHeight/newWidth are positive?
In the adjustWidthHeight function, looks like the value expected is >0. It is calculating the proportions and also dividing by the passed value. So, the value should be >0. Also, it makes sense to update the newState with (WIDTH_FLAG | HEIGHT_FLAG) only when the values are positive as the prepareImage is called with proper values depending upon whether newState has flags set or not. I have also made the formatting changes Alexey had asked for. Webrev: http://cr.openjdk.java.net/~pbansal/8230235/webrev04/ Regards, Pankaj -----Original Message----- From: Sergey Bylokhov Sent: Thursday, November 21, 2019 1:54 PM To: Pankaj Bansal; Alexey Ivanov; swing-dev Subject: Re: <Swing Dev> [14] RFR JDK-8230235 - Rendering HTML with empty img attribute and documentBaseKey cause Exception On 11/18/19 3:50 am, Pankaj Bansal wrote: > << You need to read the image to the local var under synchronization and then > get W/H from the local image variable. I guess in this case both W/H will be > 0 since error is occured? > Done. As Alexey pointed, the values are set to -1 when the error occurs. Is it fine that we pass "-1" to the "adjustWidthHeight"? I am not sure that it is ready for the negative values(where it calculates proportions). Note that prepareImage() expects only positive or "-1". Should not we update the "WIDTH_FLAG | HEIGHT_FLAG" only if the newHeight/newWidth are positive? -- Best regards, Sergey.