Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NETBEANS-1261] Avoid a rendering artifact under Aqua tabs on Retina #884

Merged
merged 1 commit into from Sep 21, 2018

Conversation

eirikbakke
Copy link
Contributor

@eirikbakke eirikbakke commented Sep 18, 2018

This commit gets rid of a thin grey line that appears under the active
tabcontrol tab when using the default Aqua LAF on MacOS retina (2x scaled)
screens. See screenshot attached to the JIRA ticket and pull request.

thin grey line fixed

AquaEditorTabCellRenderer.AquaPainter.getInteriorPolygon previously returned a
rectangle whose bottom two points were at Y coordinate (y + height - 1).
Presumably this was meant to ensure that a point at (0, y + height) would not be
considered "inside" the rectangle. That's already the case when the bottom two
points are added at (y + height) and in the order used here, however. And on
Retina displays, subtracting 1 causes trouble in painting because each logical
pixel corresponds to two, not one, physical pixels. Looking through call sites of
getInteriorPolygon, it should be safe to remove the "-1" adjustment. There are
other LAFs that don't include it either.

Tested on MacOS both with and without Retina enabled, to make sure there are no
new tab control bugs resulting from the fix. Tested clicking around the tab
control tab, and dragging and dropping tabs.

This commit gets rid of a thin grey line that appears under the active
tabcontrol tab when using the default Aqua LAF on MacOS retina (2x scaled)
screens. See screenshot attached to the JIRA ticket and pull request.

AquaEditorTabCellRenderer.AquaPainter.getInteriorPolygon previously returned a
rectangle whose bottom two points were at Y coordinate (y + height - 1).
Presumably this was meant to ensure that a point at (0, y + height) would not be
considered "inside" the rectangle. That's already the case when the bottom two
points are added at (y + height) and in the order used here, however. And on
Retina displays, subtracting 1 causes trouble in painting because each logical
pixel corresponds to two, not one, physical pixel. Looking through call sites of
getInteriorPolygon, it should be safe to remove the "-1" adjustment. There are
other LAFs that don't include it, too.

Tested on MacOS both with and without Retina enabled, to make sure there are no
new tab control bugs resulting from the fix. Tested clicking around the tab
control tab, and dragging and dropping tabs.
@geertjanw
Copy link
Member

Looks great to me, thanks for your eye for detail, really great to have. :-)

@mcdonnell-john
Copy link
Contributor

Ran this locally and compared it to 9.0. Looks a lot nicer without the line.

@matthiasblaesing
Copy link
Contributor

Merging with two positive reviews. Thank you all.

@matthiasblaesing matthiasblaesing merged commit ca9a058 into apache:master Sep 21, 2018
@eirikbakke eirikbakke deleted the NETBEANS-1261 branch October 5, 2022 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants