summaryrefslogtreecommitdiff
path: root/src/dispextern.h
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2013-09-24 09:42:30 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2013-09-24 09:42:30 +0400
commitec7bc82f9c63b6ec533f7489e67b1c1b18d08dd5 (patch)
treeb5cd6d535d5593424d85e227cf565e51c8016883 /src/dispextern.h
parent7be68de5d25998e7d15aaab800c40cad48eac846 (diff)
downloademacs-ec7bc82f9c63b6ec533f7489e67b1c1b18d08dd5.tar.gz
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.h18
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
Rows in window matrices on frames having no frame matrices point to
glyphs allocated from the heap via xmalloc;
glyphs[LEFT_MARGIN_AREA] is the start address of the allocated
- glyph structure array. */
+ glyph structure array.
+
+ NOTE: layout of first four members of this structure is important,
+ see clear_glyph_row and copy_row_except_pointers to check why. */
struct glyph_row
{
@@ -812,8 +815,13 @@ struct glyph_row
removed some day, so don't use it in new code. */
struct glyph *glyphs[1 + LAST_AREA];
- /* Number of glyphs actually filled in areas. */
- short used[LAST_AREA];
+ /* Number of glyphs actually filled in areas. This could have size
+ LAST_AREA, but it's 1 + LAST_AREA to simplify offset calculations. */
+ short used[1 + LAST_AREA];
+
+ /* Hash code. This hash code is available as soon as the row
+ is constructed, i.e. after a call to display_line. */
+ unsigned hash;
/* Window-relative x and y-position of the top-left corner of this
row. If y < 0, this means that eabs (y) pixels of the row are
@@ -846,10 +854,6 @@ struct glyph_row
in last row when checking if row is fully visible. */
int extra_line_spacing;
- /* Hash code. This hash code is available as soon as the row
- is constructed, i.e. after a call to display_line. */
- unsigned hash;
-
/* First position in this row. This is the text position, including
overlay position information etc, where the display of this row
started, and can thus be less than the position of the first