Integrated: JDK-8294680: Refactor scaled border rendering

Harshitha Onkar honkar at openjdk.org
Thu Jan 19 18:46:56 UTC 2023


On Wed, 7 Dec 2022 21:34:12 GMT, Harshitha Onkar <honkar at 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 functional parameter to the 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.

This pull request has now been integrated.

Changeset: 80ab50b3
Author:    Harshitha Onkar <honkar at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/80ab50b3389cbdae6bced7cea3f3a84b94c5bb82
Stats:     305 lines in 4 files changed: 150 ins; 137 del; 18 mod

8294680: Refactor scaled border rendering

Co-authored-by: Alexey Ivanov <aivanov at openjdk.org>
Reviewed-by: rmahajan, achung, aivanov, jdv

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

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



More information about the client-libs-dev mailing list