Commit 99efd8f
committed
Fix rendering issues when built against the 10.14 SDK.
Before this commit, the Core Text renderer relied on a legacy behavior
of NSView to keep its content across draws. setNeedsDisplayInRect: could
be used to draw over parts of the existing content as drawing commands
were received without needing to redraw old content.
Layer-backed views lose this behavior and may be asked to redraw any or
all of their content at any time, and layer backing becomes the default
for apps built against the macOS 10.14 SDK.
This change adds a way to draw to an intermediate NSImage and then
create a layer contents from that image. It's similar to the CGLayer
path, but I wasn't able to get the CGLayer path to work without hanging
or crashing when I scrolled. My best guess from looking at stack traces
is that using CGContextDrawLayerInRect to draw a layer into itself
doesn't actually copy pixels, but adds the self-draw as an action to be
performed when the CGLayer is drawn into a bitmap context. After a bunch
of scrolling, these actions stack deeper and deeper and either hang or
overflow the stack when drawn.
When on, the new code skips -drawRect: by returning YES from
-wantsUpdateLayer. -updateLayer draws into an NSImage and then creates a
layer contents from the NSImage. On my machine, scrolling a large
document seems to be faster and use less CPU vs drawRect, which is
promising.
The new code is controlled by the MMUseCALayer user default, which is on
by default in this change. Fixes #751.1 parent 8b2dcf4 commit 99efd8f
File tree
5 files changed
+37
-1
lines changed- src/MacVim
5 files changed
+37
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
| |||
448 | 454 | | |
449 | 455 | | |
450 | 456 | | |
| 457 | + | |
451 | 458 | | |
452 | 459 | | |
453 | 460 | | |
| |||
606 | 613 | | |
607 | 614 | | |
608 | 615 | | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
609 | 629 | | |
610 | 630 | | |
611 | 631 | | |
| |||
669 | 689 | | |
670 | 690 | | |
671 | 691 | | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
672 | 695 | | |
673 | 696 | | |
674 | 697 | | |
| |||
1491 | 1514 | | |
1492 | 1515 | | |
1493 | 1516 | | |
1494 | | - | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
1495 | 1526 | | |
1496 | 1527 | | |
1497 | 1528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
0 commit comments