RFR: 8279614: The left line of the TitledBorder is not painted on 150 scale factor [v6]
lukeu
duke at openjdk.java.net
Wed Mar 23 23:13:47 UTC 2022
On Wed, 23 Mar 2022 18:25:31 GMT, Alisen Chung <achung at openjdk.org> wrote:
> Can you try the recent change to see if it works at 200+%?
Sure, if it still helps here's a screenshot at 250% scaling. It shows `TitledBorder` constructed with:
* top: The JDK's `EtchedBorder` with the latest commit
* bottom: a custom `Border` testing out the `Area` idea
* (The "Title 2" in both cases is showing `RAISED`)

> It depends how slower the new code will be, probably performance will be similar?
Out of curiosity, is there is any code/documentation specific to micro-benchmarking or automated profiling of rendering code? (Also for future reference if I find time to dabble further in Swing tweaking.)
The following is not very scientific, but just putting the code for the screenshot above into in a large window (around 4000x1800px), and logging times like this:
Box box = new Box(BoxLayout.Y_AXIS) {
@Override
protected void paintChildren(java.awt.Graphics g) {
long t0 = System.nanoTime();
super.paintChildren(g);
long t1 = System.nanoTime();
System.out.format("Paint JDK: %.2f ms\n", (t1 - t0) / 1000000f);
};
};
(Ditto for the bottom pane.)
After "warming it up" by dragging the slider around until times settle a bit:
Paint TEST: 2.04 ms Paint JDK: 2.28 ms
Paint TEST: 2.56 ms Paint JDK: 3.63 ms
Paint TEST: 2.33 ms Paint JDK: 2.71 ms
Paint TEST: 6.15 ms Paint JDK: 3.46 ms
Paint TEST: 4.25 ms Paint JDK: 4.28 ms
Paint TEST: 4.93 ms Paint JDK: 3.02 ms
Paint TEST: 3.99 ms Paint JDK: 3.60 ms
Paint TEST: 3.41 ms Paint JDK: 2.96 ms
Paint TEST: 4.79 ms Paint JDK: 3.94 ms
Paint TEST: 4.19 ms Paint JDK: 5.78 ms
Paint TEST: 3.78 ms Paint JDK: 2.51 ms
Paint TEST: 4.13 ms Paint JDK: 3.57 ms
Paint TEST: 3.25 ms Paint JDK: 2.91 ms
Paint TEST: 3.31 ms Paint JDK: 4.67 ms
Paint TEST: 3.26 ms Paint JDK: 2.94 ms
Paint TEST: 3.58 ms Paint JDK: 2.88 ms
Paint TEST: 3.78 ms Paint JDK: 2.79 ms
So yeah not worlds apart, but I do feel ignorant about devices that might not have as strong graphics acceleration as my laptop.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7449
More information about the client-libs-dev
mailing list