simon-git: putty (master): Simon Tatham

Commits to Tartarus CVS repository. tartarus-commits at lists.tartarus.org
Thu Sep 24 14:23:45 BST 2015


TL;DR:
  342f287 Use a Cairo image surface as a client-side cache.

Repository:     git://git.tartarus.org/simon/putty.git
On the web:     http://tartarus.org/~simon-git/gitweb/?p=putty.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2015-09-24 14:23:45

commit 342f287660cb180a393db779df58ad4a6c9f4893
web diff http://tartarus.org/~simon-git/gitweb/?p=putty.git;a=commitdiff;h=342f287660cb180a393db779df58ad4a6c9f4893;hp=bea758a7ae0507e0d4a24b370f8401661cc1a2c8
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Sep 24 14:08:25 2015 +0100

    Use a Cairo image surface as a client-side cache.
    
    In any DRAWTYPE_CAIRO mode, we now do all our Cairo drawing to a Cairo
    image surface which lives on the client; then we either blit directly
    from that to the window (if we're in GTK3 mode, or GTK2 without
    deprecated pieces of API), or else we blit from the Cairo surface to
    the server-side pixmap and then from there to the actual window.
    
    In DRAWTYPE_GDK mode, nothing much has changed: we still draw directly
    to the server-side pixmap using the GDK drawing API, then blit from
    there to the window. But there is one change, namely that the blit is
    no longer done proactively - instead, we queue a redraw of the
    affected rectangle, and wait until we're called back by the expose
    handler.
    
    The main aim of all this is to arrange that the only time we ever draw
    to the real window is in response to expose/draw events. The
    experimental GTK3 OS X port stopped working a week or two ago (I
    presume in response to an OS update) with the symptoms that attempts
    to draw on the window outside the context of a "draw" event handler
    just didn't seem to work any more; this change fixes it.
    
    In addition to that benefit, this change also has obvious performance
    advantages in principle. No more expensive text rendering in response
    to an expose event - just re-copy to the window from the bitmap we
    already have, from wherever it's stored that's nearest.
    
    Moreover, this seems to have fixed the significant performance problem
    with X server-side fonts under GTK. I didn't expect _that_! I'd
    guessed that the approach of downloading character bitmaps and
    rendering them manually via Cairo was just inherently slow for some
    reason. I've no real idea _why_ this change improves matters so much;
    my best guess is that perhaps there's an overhead in each drawing
    operation to a GDK Cairo surface, so we win by doing lots of
    operations to a much faster image surface and then batching them up
    into one GDK Cairo operation. But whyever it is, I'm certainly not
    complaining!
    
    (In fact, it now seems to be noticeably _faster_, at least on my usual
    local X displays, to draw server-side fonts using that technique than
    using the old GDK approach. I may yet decide to switch over...)

 unix/gtkwin.c |  180 +++++++++++++++++++++++++++++++++------------------------
 1 file changed, 104 insertions(+), 76 deletions(-)



More information about the tartarus-commits mailing list