gtk2/gsk/gl/gskglglyphcacheprivate.h
Matthias Clasen 259bbdcb09 Share glyph and icon caches
Use the same texture atlases to back both
the glyph and icon caches, and unify their
sizes and management. Store big glyphs
in separate textures, so all atlases have
the same size. Tweak some of the eviction
parameters.

We share the caches across all GL contexts
on a display, unless the GSK_NO_SHARED_CACHES
env var is set.
2019-06-04 23:00:02 +00:00

67 lines
2.1 KiB
C

#ifndef __GSK_GL_GLYPH_CACHE_PRIVATE_H__
#define __GSK_GL_GLYPH_CACHE_PRIVATE_H__
#include "gskgldriverprivate.h"
#include "gskglimageprivate.h"
#include "gskgltextureatlasprivate.h"
#include <pango/pango.h>
#include <gdk/gdk.h>
typedef struct
{
int ref_count;
GdkDisplay *display;
GHashTable *hash_table;
GskGLTextureAtlases *atlases;
guint64 timestamp;
} GskGLGlyphCache;
typedef struct
{
PangoFont *font;
PangoGlyph glyph;
guint scale; /* times 1024 */
} GlyphCacheKey;
typedef struct _GskGLCachedGlyph GskGLCachedGlyph;
struct _GskGLCachedGlyph
{
GskGLTextureAtlas *atlas;
guint texture_id;
float tx;
float ty;
float tw;
float th;
int draw_x;
int draw_y;
int draw_width;
int draw_height;
guint64 timestamp;
guint used: 1;
};
GskGLGlyphCache * gsk_gl_glyph_cache_new (GdkDisplay *display,
GskGLTextureAtlases *atlases);
GskGLGlyphCache * gsk_gl_glyph_cache_ref (GskGLGlyphCache *self);
void gsk_gl_glyph_cache_unref (GskGLGlyphCache *self);
void gsk_gl_glyph_cache_begin_frame (GskGLGlyphCache *self);
gboolean gsk_gl_glyph_cache_lookup (GskGLGlyphCache *self,
PangoFont *font,
PangoGlyph glyph,
float scale,
GskGLCachedGlyph *cached_glyph_out);
void gsk_gl_glyph_cache_get_texture (GskGLDriver *driver,
PangoFont *font,
PangoGlyph glyph,
float scale,
GskGLCachedGlyph *glyph_out);
#endif