RFR: JDK-8294680: Refactor scaled border rendering [v6]
Harshitha Onkar
honkar at openjdk.org
Wed Jan 11 23:20:02 UTC 2023
> 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.
Harshitha Onkar has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits:
- removed unused parameters, old stroke changes
- Merge branch 'master' into RefactorBorder_8294484
- moved strokeWidth logic to individual classes
- review changes
- Revert "test changes"
This reverts commit abed51bd420941d8efa7b779b86257978f56810e.
- test changes
- minor changes
- Merge branch 'master' into RefactorBorder_8294484
- Merge branch 'master' into RefactorBorder_8294484
- review changes
- ... and 5 more: https://git.openjdk.org/jdk/compare/43847c43...9caca6b2
-------------
Changes: https://git.openjdk.org/jdk/pull/11571/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11571&range=05
Stats: 248 lines in 4 files changed: 95 ins; 142 del; 11 mod
Patch: https://git.openjdk.org/jdk/pull/11571.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11571/head:pull/11571
PR: https://git.openjdk.org/jdk/pull/11571
More information about the client-libs-dev
mailing list