RFR: 8279614: The left line of the TitledBorder is not painted on 150 scale factor [v6]

lukeu duke at openjdk.java.net
Mon Mar 21 22:40:32 UTC 2022


On Thu, 17 Mar 2022 23:50:21 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> Changed the drawing area to be increased by 0.5 on the left side to prevent clipping
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixed apostrophe in comment of saveImage

I'm not sure if it'd be acceptable performance-wise (like across all platforms) but the code could jump to an area-based fill when needing to render lines with thickness > 1. For example (after removing scaling)...

    Color c1 = (etchType == LOWERED) ? getHighlightColor(c) : getShadowColor(c);
    Color c2 = (etchType == LOWERED) ? getShadowColor(c) : getHighlightColor(c);

    int thick = (int) Math.floor(Math.max(at.getScaleX(), at.getScaleY()));

    if (thick < 2) {
        // Use current line-based code (faster?)
    } else {
        g.setColor(c1);
        Area a = new Area(new Rectangle(0, 0, w, h));
        a.subtract(new Area(new Rectangle(thick*2, thick*2, w-thick*4, h-thick*4)));
        g2d.fill(a);

        g.setColor(c2);
        a = new Area(new Rectangle(0, 0, w - thick, h - thick));
        a.subtract(new Area(new Rectangle(thick, thick, w-thick*3, h-thick*3)));
        g2d.fill(a);
    }

Somehow this [post by Jim Graham ](https://markmail.org/search/?q=jim+graham+line+hidpi#query:jim%20graham%20line%20hidpi+page:1+mid:bwen5wqb5fogoh64+state:results )came back to mind while thinking about all this. I recall being interested that JavaFX "components are outlined using successive fills".

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

PR: https://git.openjdk.java.net/jdk/pull/7449



More information about the client-libs-dev mailing list