diff options
author | Christian Hergert <chergert@redhat.com> | 2019-07-26 10:40:43 -0700 |
---|---|---|
committer | Christian Hergert <chergert@redhat.com> | 2019-07-28 10:34:15 -0700 |
commit | 9926e6ebde28956ae65e5127966fd740552fbe6a (patch) | |
tree | 39a8c56dd5b059b2b1da5b8097e2160344617150 /gtk/gtktextlinedisplaycacheprivate.h | |
parent | b930c5a8a2545a8534585ae92f2d25a9581d345d (diff) | |
download | gtk+-9926e6ebde28956ae65e5127966fd740552fbe6a.tar.gz |
textlayout: introduce caching for GtkTextLineDisplay
This adds a GtkTextLineDisplayCache which can be used to cache a number
of GtkTextLineDisplay (and thus, PangoLayout) while displaying a view.
It uses a GSequence to track the position of the GtkTextLineDisplay
relative to each other, a MRU to cull the least recently used display,
and and a direct hashtable to lookup display by GtkTextLine.
We only cache lines that are to be displayed (!size_only). We may want to
either create a second collection of "size_only" lines to speed that up,
or determine that it is unnecessary (which is likely the case).
Diffstat (limited to 'gtk/gtktextlinedisplaycacheprivate.h')
-rw-r--r-- | gtk/gtktextlinedisplaycacheprivate.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gtk/gtktextlinedisplaycacheprivate.h b/gtk/gtktextlinedisplaycacheprivate.h new file mode 100644 index 0000000000..5639ec2070 --- /dev/null +++ b/gtk/gtktextlinedisplaycacheprivate.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* GTK - The GIMP Toolkit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 2019 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __GTK_TEXT_LINE_DISPLAY_CACHE_PRIVATE_H__ +#define __GTK_TEXT_LINE_DISPLAY_CACHE_PRIVATE_H__ + +#include "gtktextlayoutprivate.h" + +G_BEGIN_DECLS + +typedef struct _GtkTextLineDisplayCache GtkTextLineDisplayCache; + +GtkTextLineDisplayCache *gtk_text_line_display_cache_new (void); +void gtk_text_line_display_cache_free (GtkTextLineDisplayCache *cache); +GtkTextLineDisplay *gtk_text_line_display_cache_get (GtkTextLineDisplayCache *cache, + GtkTextLayout *layout, + GtkTextLine *line, + gboolean size_only); +void gtk_text_line_display_cache_delay_eviction (GtkTextLineDisplayCache *cache); +void gtk_text_line_display_cache_set_cursor_line (GtkTextLineDisplayCache *cache, + GtkTextLine *line); +void gtk_text_line_display_cache_invalidate (GtkTextLineDisplayCache *cache); +void gtk_text_line_display_cache_invalidate_cursors (GtkTextLineDisplayCache *cache, + GtkTextLine *line); +void gtk_text_line_display_cache_invalidate_display (GtkTextLineDisplayCache *cache, + GtkTextLineDisplay *display, + gboolean cursors_only); +void gtk_text_line_display_cache_invalidate_line (GtkTextLineDisplayCache *cache, + GtkTextLine *line); +void gtk_text_line_display_cache_invalidate_range (GtkTextLineDisplayCache *cache, + GtkTextLayout *layout, + const GtkTextIter *begin, + const GtkTextIter *end, + gboolean cursors_only); +void gtk_text_line_display_cache_invalidate_y_range (GtkTextLineDisplayCache *cache, + GtkTextLayout *layout, + gint y, + gint height, + gboolean cursors_only); + +G_END_DECLS + +#endif /* __GTK_TEXT_LINE_DISPLAY_CACHE_PRIVATE_H__ */ |