2017-11-18 13:30:57 +00:00
|
|
|
#ifndef __GSK_GL_GLYPH_CACHE_PRIVATE_H__
|
|
|
|
#define __GSK_GL_GLYPH_CACHE_PRIVATE_H__
|
|
|
|
|
|
|
|
#include "gskgldriverprivate.h"
|
|
|
|
#include "gskglimageprivate.h"
|
2018-01-14 14:52:52 +00:00
|
|
|
#include "gskrendererprivate.h"
|
2017-11-18 13:30:57 +00:00
|
|
|
#include <pango/pango.h>
|
|
|
|
#include <gdk/gdk.h>
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GskGLDriver *gl_driver;
|
2018-01-14 14:52:52 +00:00
|
|
|
GskRenderer *renderer;
|
2017-11-18 13:30:57 +00:00
|
|
|
|
|
|
|
GHashTable *hash_table;
|
|
|
|
GPtrArray *atlases;
|
|
|
|
|
|
|
|
guint64 timestamp;
|
|
|
|
} GskGLGlyphCache;
|
|
|
|
|
2019-01-06 14:35:54 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
PangoFont *font;
|
|
|
|
PangoGlyph glyph;
|
|
|
|
guint scale; /* times 1024 */
|
|
|
|
} GlyphCacheKey;
|
|
|
|
|
|
|
|
typedef struct _DirtyGlyph DirtyGlyph;
|
|
|
|
typedef struct _GskGLCachedGlyph GskGLCachedGlyph;
|
|
|
|
|
|
|
|
struct _DirtyGlyph
|
|
|
|
{
|
|
|
|
GlyphCacheKey *key;
|
|
|
|
GskGLCachedGlyph *value;
|
|
|
|
};
|
2017-11-18 13:30:57 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GskGLImage *image;
|
|
|
|
int width, height;
|
|
|
|
int x, y, y0;
|
|
|
|
guint old_pixels;
|
2019-01-06 14:35:54 +00:00
|
|
|
|
|
|
|
DirtyGlyph pending_glyph;
|
2017-11-18 13:30:57 +00:00
|
|
|
} GskGLGlyphAtlas;
|
|
|
|
|
2019-01-06 14:35:54 +00:00
|
|
|
struct _GskGLCachedGlyph
|
2017-11-18 13:30:57 +00:00
|
|
|
{
|
|
|
|
GskGLGlyphAtlas *atlas;
|
|
|
|
|
|
|
|
float tx;
|
|
|
|
float ty;
|
|
|
|
float tw;
|
|
|
|
float th;
|
|
|
|
|
|
|
|
int draw_x;
|
|
|
|
int draw_y;
|
|
|
|
int draw_width;
|
|
|
|
int draw_height;
|
|
|
|
|
2019-01-10 16:14:48 +00:00
|
|
|
float scale;
|
|
|
|
|
2017-11-18 13:30:57 +00:00
|
|
|
guint64 timestamp;
|
2019-01-06 14:35:54 +00:00
|
|
|
};
|
|
|
|
|
2017-11-18 13:30:57 +00:00
|
|
|
|
|
|
|
void gsk_gl_glyph_cache_init (GskGLGlyphCache *self,
|
2018-01-14 14:52:52 +00:00
|
|
|
GskRenderer *renderer,
|
2017-11-18 13:30:57 +00:00
|
|
|
GskGLDriver *gl_driver);
|
|
|
|
void gsk_gl_glyph_cache_free (GskGLGlyphCache *self);
|
|
|
|
void gsk_gl_glyph_cache_begin_frame (GskGLGlyphCache *self);
|
|
|
|
GskGLImage * gsk_gl_glyph_cache_get_glyph_image (GskGLGlyphCache *self,
|
|
|
|
const GskGLCachedGlyph *glyph);
|
|
|
|
const GskGLCachedGlyph * gsk_gl_glyph_cache_lookup (GskGLGlyphCache *self,
|
|
|
|
gboolean create,
|
|
|
|
PangoFont *font,
|
|
|
|
PangoGlyph glyph,
|
|
|
|
float scale);
|
|
|
|
|
|
|
|
#endif
|