On Mon, 12 Dec 2022 22:43:08 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:

>> In this fix, the common code required for scaled border rendering is unified 
>> and added to SwingUtilities3. This is achieved by adding a functional 
>> interface to SwingUtilities3 and calling the the respective paintBorder 
>> function passed as parameter to method.  
>> 
>> Following are the usual steps for any border scaling -
>> 
>> - Resetting transform.
>> - Calculating new width, height, x & y-translations.
>> - Perform the required border rendering.
>> - And at the end restore the previous transform.
>> 
>> To test the refactored code, 3 separate border scaling instances were taken 
>> (details below) and the SwingUtilities3.paintBorder, (containing the common 
>> functionality) was applied. All the tests associated with the respective 
>> border changes pass.
>> 
>> 1. EtchedBorder - [PR#7449](https://github.com/openjdk/jdk/pull/7449) - 
>> Test: ScaledEtchedBorderTest.java
>> 2. LineBorder - [PR#10681](https://github.com/openjdk/jdk/pull/10681) - 
>> Test: ScaledLineBorderTest & ScaledTextFieldBorderTest.java
>> 3. JInternalFrame Border - 
>> [PR#10274](https://github.com/openjdk/jdk/pull/10274) - Test: 
>> InternalFrameBorderTest.java
>> 
>> The advantage of this solution is - it avoids code repetition and can be 
>> reused across all the border classes requiring border scaling fix.
>
> Harshitha Onkar has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   review changes

src/java.desktop/share/classes/javax/swing/border/LineBorder.java line 151:

> 149:     private void paintUnscaledBorder(Component c, Graphics g, int x, int 
> y,
> 150:                                      int w, int h, double scale, int 
> stroke) {
> 151:         if ((this.thickness > 0)) {

Suggestion:

        if (this.thickness > 0) {

src/java.desktop/share/classes/javax/swing/border/LineBorder.java line 152:

> 150:                                      int w, int h, double scale, int 
> stroke) {
> 151:         if ((this.thickness > 0)) {
> 152:             int offs =  this.thickness * (int) scale;

Suggestion:

            int offs = this.thickness * (int) scale;

-------------

PR: https://git.openjdk.org/jdk/pull/11571

Reply via email to