Commit ff86c19
committed
Agg: Use 32-bit scan line classes
When rendering objects, Agg rasterizes them into scan line objects (an
x/y point, horizontal length, and colour), and the renderer class writes
those to the pixels in the final buffer. Though we have determined that
Agg buffers cannot be larger than 2**16, the scan line classes that we
use contain 16-bit _signed_ integers internally, cutting off positive
values at half the maximum.
Since the renderer uses 32-bit integers, this can cause odd behaviour
where any horizontal span that _starts_ before 2**15 (such as a
horizontal spine) is rendered correctly even if it cross that point,
but those that start after (such as a vertical spine or any portion of
an angled line) end up clipped. For example, see how the spines and
lines break in #28893.
A similar problem occurs for resampled images, which also uses Agg
scanlines internally. See the breakage in #26368 for an example. The
example in that issue also contains horizontal spines that are wider
than 2**15, which also exhibit strange behaviour.
By moving to 32-bit scan lines, positions and lengths of the lines will
no longer be clipped, and this fixes rendering on very large figures.
Fixes #23826
Fixes #26368
Fixes #288931 parent e90952f commit ff86c19
2 files changed
+31
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | | - | |
| 120 | + | |
| 121 | + | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
699 | 702 | | |
700 | 703 | | |
701 | 704 | | |
702 | | - | |
703 | | - | |
| 705 | + | |
| 706 | + | |
704 | 707 | | |
705 | 708 | | |
706 | 709 | | |
| |||
712 | 715 | | |
713 | 716 | | |
714 | 717 | | |
| 718 | + | |
715 | 719 | | |
716 | 720 | | |
717 | 721 | | |
| |||
739 | 743 | | |
740 | 744 | | |
741 | 745 | | |
742 | | - | |
| 746 | + | |
743 | 747 | | |
744 | 748 | | |
745 | 749 | | |
| |||
828 | 832 | | |
829 | 833 | | |
830 | 834 | | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
831 | 856 | | |
0 commit comments