emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stipples and scroll optimizations


From: Eli Zaretskii
Subject: Re: Stipples and scroll optimizations
Date: Sun, 08 May 2022 13:46:56 +0300

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 08 May 2022 17:20:14 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Sorry, I don't understand: what is the "previous" glyph matrix, and
> > how can you use it for this test?
> 
> I mean the glyph matrix representing what is currently on the glass, the
> "current matrix".

But that can be different (even VERY different) from what _should_ be
on the glass.  We cannot rely on the current matrix for making such
decisions.

> > Really?  I see that 'struct face' has a 'stipple' member, which is set
> > in realize_gui_face, and that happens when we realize the face, long
> > before x_draw_glyph_string is called.  And each glyph in a glyph_row
> > has a face_id member, which allows you to get at the corresponding
> > face structure.  Why cannot you use this to detect glyph_row's that
> > use stipples?  The only type of glyph whose stipple is ignored is the
> > cursor glyph, and that hardly matters for your purposes here, no?
> 
> Whether or not a stipple is present usually depends on the `stippled_p'
> flag, which is set in `x_set_glyph_string_gc'.  But for starters,
> drawing an image glyph might change that flag, and an image might also
> obscure the stipple entirely, in which case we don't want to inhibit the
> scrolling optimization.

The logic is very simple (see x_set_glyph_string_gc) and depends only
the kind of "highlight" with which a glyph string should be
displayed.  All types of highlight except DRAW_CURSOR do the same when
the set the stippled_p flag of a glyph string: they all set it if the
face's 'stipple' member is non-zero.  Why cannot update_window do the
same?  If drawing the image glyph can change the flag (though I cannot
see where it does), then the same logic that depends on seeing image
glyphs in a glyph-row can be added to update_window.

So I still don't see what difficulties could there be in the method I
suggested, and what would be the advantages of doing what you wanted
after the first call to x_draw_glyph_string.

Please also note that update_window, and with it scrolling_window,
work _per_glyph_row_, whereas x_draw_glyph_string works
_per_glyph_string_, which is part of a glyph row.  So theoretically,
it could be that the first calls to x_draw_glyph_string don't see any
stippled face, and thus don't set the flag you want, so by the time
you realize that scrolling_window cannot be used it's too late.  (And
in general, scrolling_window is called _before_ we call
update_window_line, which is where x_draw_glyph_string is called.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]