diff options
| author | Dmitry Antipov | 2013-09-24 09:42:30 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-09-24 09:42:30 +0400 |
| commit | ec7bc82f9c63b6ec533f7489e67b1c1b18d08dd5 (patch) | |
| tree | b5cd6d535d5593424d85e227cf565e51c8016883 /src/dispextern.h | |
| parent | 7be68de5d25998e7d15aaab800c40cad48eac846 (diff) | |
| download | emacs-ec7bc82f9c63b6ec533f7489e67b1c1b18d08dd5.tar.gz emacs-ec7bc82f9c63b6ec533f7489e67b1c1b18d08dd5.zip | |
Optimize glyph row clearing and copying routines.
* dispextern.h (struct glyph_row): Change layout of struct
glyph_row to help copy_row_except_pointers. Adjust comment.
* dispnew.c (null_row): Remove.
(clear_glyph_row): Use offsetof and memset to find and clear
just the members that need clearing. Adjust comment.
(copy_row_except_pointers): Likewise for copying.
Diffstat (limited to 'src/dispextern.h')
| -rw-r--r-- | src/dispextern.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index 84111bd9958..5ddc177bcf0 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -792,7 +792,10 @@ enum glyph_row_area | |||
| 792 | Rows in window matrices on frames having no frame matrices point to | 792 | Rows in window matrices on frames having no frame matrices point to |
| 793 | glyphs allocated from the heap via xmalloc; | 793 | glyphs allocated from the heap via xmalloc; |
| 794 | glyphs[LEFT_MARGIN_AREA] is the start address of the allocated | 794 | glyphs[LEFT_MARGIN_AREA] is the start address of the allocated |
| 795 | glyph structure array. */ | 795 | glyph structure array. |
| 796 | |||
| 797 | NOTE: layout of first four members of this structure is important, | ||
| 798 | see clear_glyph_row and copy_row_except_pointers to check why. */ | ||
| 796 | 799 | ||
| 797 | struct glyph_row | 800 | struct glyph_row |
| 798 | { | 801 | { |
| @@ -812,8 +815,13 @@ struct glyph_row | |||
| 812 | removed some day, so don't use it in new code. */ | 815 | removed some day, so don't use it in new code. */ |
| 813 | struct glyph *glyphs[1 + LAST_AREA]; | 816 | struct glyph *glyphs[1 + LAST_AREA]; |
| 814 | 817 | ||
| 815 | /* Number of glyphs actually filled in areas. */ | 818 | /* Number of glyphs actually filled in areas. This could have size |
| 816 | short used[LAST_AREA]; | 819 | LAST_AREA, but it's 1 + LAST_AREA to simplify offset calculations. */ |
| 820 | short used[1 + LAST_AREA]; | ||
| 821 | |||
| 822 | /* Hash code. This hash code is available as soon as the row | ||
| 823 | is constructed, i.e. after a call to display_line. */ | ||
| 824 | unsigned hash; | ||
| 817 | 825 | ||
| 818 | /* Window-relative x and y-position of the top-left corner of this | 826 | /* Window-relative x and y-position of the top-left corner of this |
| 819 | row. If y < 0, this means that eabs (y) pixels of the row are | 827 | row. If y < 0, this means that eabs (y) pixels of the row are |
| @@ -846,10 +854,6 @@ struct glyph_row | |||
| 846 | in last row when checking if row is fully visible. */ | 854 | in last row when checking if row is fully visible. */ |
| 847 | int extra_line_spacing; | 855 | int extra_line_spacing; |
| 848 | 856 | ||
| 849 | /* Hash code. This hash code is available as soon as the row | ||
| 850 | is constructed, i.e. after a call to display_line. */ | ||
| 851 | unsigned hash; | ||
| 852 | |||
| 853 | /* First position in this row. This is the text position, including | 857 | /* First position in this row. This is the text position, including |
| 854 | overlay position information etc, where the display of this row | 858 | overlay position information etc, where the display of this row |
| 855 | started, and can thus be less than the position of the first | 859 | started, and can thus be less than the position of the first |