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
Rework glyphs drawing. Use fixed font size measurements. #80
Rework glyphs drawing. Use fixed font size measurements. #80
Conversation
…ng lines. Improves performance.
@@ -115,6 +114,9 @@ public class TerminalView: NSView, NSTextInputClient, NSUserInterfaceValidations | |||
|
|||
func setup(frame: CGRect, bounds: CGRect) | |||
{ | |||
wantsLayer = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we use the layer for? Is this a good idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good question.
I used it to have a background without drawing because when drawing in context, it interferes with how selection/background color blending.
I didn't notice a side effect, but now I'm not sure
on one hand:
https://developer.apple.com/documentation/appkit/nsview/1483695-wantslayer
In a layer-backed view, any drawing done by the view is cached to the underlying layer object. This cached content can then be manipulated in ways that are more performant than redrawing the view contents explicitly.
on the other
https://developer.apple.com/documentation/appkit/nsview/1483686-drawrect
If your app manages content using its layer object instead, use the updateLayer method to update your layer instead of overriding this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're good, after checking wantsUpdateLayer()
https://developer.apple.com/documentation/appkit/nsview/1483461-wantsupdatelayer
A view can update its contents using one of two techniques. It can draw those contents using its draw(:) method or it can modify its underlying layer object directly. During the view update cycle, each dirty view calls this method on itself to determine which technique to use. The default implementation of this method returns false, which causes the view to use its draw(:) method.
This looks very good, let me test it a little bit locally tonight. |
This imrproves the rendering performance and fixes selection. It makes the simple benchmark go from 0m0.827s to 0m0.538s. |
If we can turn off the layer, we could turn it off. Might be more resource friendly. |
Well That said, I just added code to render under there, and that should have been triggering |
Fixes #67