gpu: Allow creating GskGpuCached objects externally
Export the GskGpuCached and GskGpuCachedClass objects in the header, and make gsk_gpu_cached_new() available.
This commit is contained in:
@@ -27,9 +27,6 @@
|
||||
G_STATIC_ASSERT (MAX_ATLAS_ITEM_SIZE < ATLAS_SIZE);
|
||||
G_STATIC_ASSERT (MIN_ALIVE_PIXELS < ATLAS_SIZE * ATLAS_SIZE);
|
||||
|
||||
typedef struct _GskGpuCached GskGpuCached;
|
||||
typedef struct _GskGpuCachedClass GskGpuCachedClass;
|
||||
typedef struct _GskGpuCachedAtlas GskGpuCachedAtlas;
|
||||
typedef struct _GskGpuCachedGlyph GskGpuCachedGlyph;
|
||||
typedef struct _GskGpuCachedTexture GskGpuCachedTexture;
|
||||
typedef struct _GskGpuCachedTile GskGpuCachedTile;
|
||||
@@ -58,32 +55,6 @@ G_DEFINE_TYPE (GskGpuCache, gsk_gpu_cache, G_TYPE_OBJECT)
|
||||
|
||||
/* {{{ Cached base class */
|
||||
|
||||
struct _GskGpuCachedClass
|
||||
{
|
||||
gsize size;
|
||||
const char *name;
|
||||
|
||||
void (* free) (GskGpuCache *cache,
|
||||
GskGpuCached *cached);
|
||||
gboolean (* should_collect) (GskGpuCache *cache,
|
||||
GskGpuCached *cached,
|
||||
gint64 cache_timeout,
|
||||
gint64 timestamp);
|
||||
};
|
||||
|
||||
struct _GskGpuCached
|
||||
{
|
||||
const GskGpuCachedClass *class;
|
||||
|
||||
GskGpuCachedAtlas *atlas;
|
||||
GskGpuCached *next;
|
||||
GskGpuCached *prev;
|
||||
|
||||
gint64 timestamp;
|
||||
gboolean stale;
|
||||
guint pixels; /* For glyphs and textures, pixels. For atlases, alive pixels */
|
||||
};
|
||||
|
||||
static inline void
|
||||
mark_as_stale (GskGpuCached *cached,
|
||||
gboolean stale)
|
||||
@@ -151,7 +122,7 @@ gsk_gpu_cached_new_from_atlas (GskGpuCache *cache,
|
||||
return cached;
|
||||
}
|
||||
|
||||
static gpointer
|
||||
gpointer
|
||||
gsk_gpu_cached_new (GskGpuCache *cache,
|
||||
const GskGpuCachedClass *class)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,36 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GskGpuCached GskGpuCached;
|
||||
typedef struct _GskGpuCachedClass GskGpuCachedClass;
|
||||
typedef struct _GskGpuCachedAtlas GskGpuCachedAtlas;
|
||||
|
||||
struct _GskGpuCachedClass
|
||||
{
|
||||
gsize size;
|
||||
const char *name;
|
||||
|
||||
void (* free) (GskGpuCache *cache,
|
||||
GskGpuCached *cached);
|
||||
gboolean (* should_collect) (GskGpuCache *cache,
|
||||
GskGpuCached *cached,
|
||||
gint64 cache_timeout,
|
||||
gint64 timestamp);
|
||||
};
|
||||
|
||||
struct _GskGpuCached
|
||||
{
|
||||
const GskGpuCachedClass *class;
|
||||
|
||||
GskGpuCachedAtlas *atlas;
|
||||
GskGpuCached *next;
|
||||
GskGpuCached *prev;
|
||||
|
||||
gint64 timestamp;
|
||||
gboolean stale;
|
||||
guint pixels; /* For glyphs and textures, pixels. For atlases, alive pixels */
|
||||
};
|
||||
|
||||
#define GSK_TYPE_GPU_CACHE (gsk_gpu_cache_get_type ())
|
||||
#define GSK_GPU_CACHE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSK_TYPE_GPU_CACHE, GskGpuCache))
|
||||
#define GSK_GPU_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSK_TYPE_GPU_CACHE, GskGpuCacheClass))
|
||||
@@ -24,8 +54,12 @@ GType gsk_gpu_cache_get_type (void) G
|
||||
|
||||
GskGpuCache * gsk_gpu_cache_new (GskGpuDevice *device);
|
||||
|
||||
gpointer gsk_gpu_cached_new (GskGpuCache *cache,
|
||||
const GskGpuCachedClass *class);
|
||||
|
||||
void gsk_gpu_cache_set_time (GskGpuCache *self,
|
||||
gint64 timestamp);
|
||||
|
||||
gboolean gsk_gpu_cache_gc (GskGpuCache *self,
|
||||
gint64 cache_timeout,
|
||||
gint64 timestamp);
|
||||
|
||||
Reference in New Issue
Block a user