Hi Krishna, One clarification about the change:
The said solution holds good for an image with an aspect ratio of 1:1. Can this aspect ratio be considered default? I think we should derive the aspect ratio from the image and use that value to calculate the unknown attribute of the scale information!! Thanks and regards, Shashi From: Krishna Addepalli Sent: Wednesday, July 11, 2018 2:03 PM To: Prasanta Sadhukhan <prasanta.sadhuk...@oracle.com>; swing-dev@openjdk.java.net Subject: Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not maintained when image is scaled in JEditorPane Thanks for the review Prasanta. I need one more review to push this regression. Thanks, Krishna From: Prasanta Sadhukhan Sent: Wednesday, July 11, 2018 10:28 AM To: Krishna Addepalli <HYPERLINK "mailto:krishna.addepa...@oracle.com"krishna.addepa...@oracle.com>; HYPERLINK "mailto:swing-dev@openjdk.java.net"swing-dev@openjdk.java.net Subject: Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not maintained when image is scaled in JEditorPane +1 Regards Prasanta On 7/10/2018 6:59 PM, Krishna Addepalli wrote: Sorry my bad. Here is the new webrev: HYPERLINK "http://cr.openjdk.java.net/%7Ekaddepalli/8206238/webrev02/"http://cr.openjdk.java.net/~kaddepalli/8206238/webrev02/ Thanks, Krishna From: Prasanta Sadhukhan Sent: Tuesday, July 10, 2018 6:03 PM To: Krishna Addepalli HYPERLINK "mailto:krishna.addepa...@oracle.com"<krishna.addepa...@oracle.com>; HYPERLINK "mailto:swing-dev@openjdk.java.net"swing-dev@openjdk.java.net Subject: Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not maintained when image is scaled in JEditorPane Ok. Thanks for the clarification. Btw, there is another reversal as I mentioned earlier 158 System.out.println("Test with only height set to 100"); 159 test(r, editorPanes[4], 100, 100); 160 161 System.out.println("Test with only width set to 100"); 162 test(r, editorPanes[5], 100, 100); as editorPane[4] tests width 100 121 editorPanes[4] = new JEditorPane("text/html", 122 "<img width=\"100\" src =\" Regards Prasanta On 7/10/2018 5:54 PM, Krishna Addepalli wrote: Hi Prasanta, Thanks for your review. Here is the updated webrev: HYPERLINK "http://cr.openjdk.java.net/%7Ekaddepalli/8206238/webrev01/"http://cr.openjdk.java.net/~kaddepalli/8206238/webrev01/ So, the actual width and height of the image is 200, but the bug is that when any other value (only height or width) is specified, then the image should be scaled to that size(both width and height). The test tests the same with different values like 100, 50 and 300 apart from the original image size of 200. Hope this clarifies. Thanks, Krishna From: Prasanta Sadhukhan Sent: Tuesday, July 10, 2018 3:48 PM To: Krishna Addepalli HYPERLINK "mailto:krishna.addepa...@oracle.com"<krishna.addepa...@oracle.com>; HYPERLINK "mailto:swing-dev@openjdk.java.net"swing-dev@openjdk.java.net Subject: Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not maintained when image is scaled in JEditorPane Fix looks good to me. For test, 152 System.out.println("Test with none of them set"); 153 test(r, editorPanes[2], 200, 200); 154 155 System.out.println("Test with both of them set to 200"); 156 test(r, editorPanes[3], 200, 200); should be reversed as you do 115 editorPanes[2] = new JEditorPane("text/html", 116 "<img width=\"200\" height=\"200\" src=\HYPERLINK "file:///\\""file:///" + ABSOLUTE_FILE_PATH + "\""); 117 118 editorPanes[3] = new JEditorPane("text/html", 119 "<img src=\HYPERLINK "file:///\\""file:///" + ABSOLUTE_FILE_PATH + "\""); Same for 158, 161. Also, what is the need for 158 System.out.println("Test with only height set to 100"); when you already have a test for height only 146 System.out.println("Test with only height set to 200"); SImilar for width. Regards Prasanta On 7/10/2018 3:15 PM, Krishna Addepalli wrote: Hi All, Please review a fix for the bug JDK-8206238: https://bugs.openjdk.java.net/browse/JDK-8206238 Webrev: HYPERLINK "http://cr.openjdk.java.net/%7Ekaddepalli/8206238/webrev00/"http://cr.openjdk.java.net/~kaddepalli/8206238/webrev00/ The problem is that, when any one of the attributes for the image (height/width), are specified, it should copy the value to the other attribute. Currently, it only updates the respective attribute, and fills the other attribute with the size of the image. Fixed this problem in the proposed patch. Thanks, Krishna