2023-08-12 20:10:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "gskgputypesprivate.h"
|
|
|
|
|
2023-09-06 00:11:39 +00:00
|
|
|
#include <graphene.h>
|
|
|
|
|
2023-08-12 20:10:16 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GSK_TYPE_GPU_DEVICE (gsk_gpu_device_get_type ())
|
|
|
|
#define GSK_GPU_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSK_TYPE_GPU_DEVICE, GskGpuDevice))
|
|
|
|
#define GSK_GPU_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSK_TYPE_GPU_DEVICE, GskGpuDeviceClass))
|
|
|
|
#define GSK_IS_GPU_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSK_TYPE_GPU_DEVICE))
|
|
|
|
#define GSK_IS_GPU_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSK_TYPE_GPU_DEVICE))
|
|
|
|
#define GSK_GPU_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSK_TYPE_GPU_DEVICE, GskGpuDeviceClass))
|
|
|
|
|
|
|
|
typedef struct _GskGpuDeviceClass GskGpuDeviceClass;
|
|
|
|
|
|
|
|
struct _GskGpuDevice
|
|
|
|
{
|
|
|
|
GObject parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GskGpuDeviceClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
GskGpuImage * (* create_offscreen_image) (GskGpuDevice *self,
|
2023-11-01 05:43:15 +00:00
|
|
|
gboolean with_mipmap,
|
2023-08-12 20:10:16 +00:00
|
|
|
GdkMemoryDepth depth,
|
|
|
|
gsize width,
|
|
|
|
gsize height);
|
2023-09-25 19:12:20 +00:00
|
|
|
GskGpuImage * (* create_atlas_image) (GskGpuDevice *self,
|
|
|
|
gsize width,
|
|
|
|
gsize height);
|
2023-08-12 20:10:16 +00:00
|
|
|
GskGpuImage * (* create_upload_image) (GskGpuDevice *self,
|
2023-11-01 05:43:15 +00:00
|
|
|
gboolean with_mipmap,
|
2023-08-12 20:10:16 +00:00
|
|
|
GdkMemoryFormat format,
|
|
|
|
gsize width,
|
|
|
|
gsize height);
|
2023-11-24 00:27:44 +00:00
|
|
|
GskGpuImage * (* create_download_image) (GskGpuDevice *self,
|
|
|
|
GdkMemoryDepth depth,
|
|
|
|
gsize width,
|
|
|
|
gsize height);
|
2023-08-12 20:10:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GType gsk_gpu_device_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
void gsk_gpu_device_setup (GskGpuDevice *self,
|
2023-10-12 21:53:12 +00:00
|
|
|
GdkDisplay *display,
|
|
|
|
gsize max_image_size);
|
2023-09-01 10:11:06 +00:00
|
|
|
void gsk_gpu_device_gc (GskGpuDevice *self,
|
|
|
|
gint64 timestamp);
|
2023-08-12 20:10:16 +00:00
|
|
|
|
|
|
|
GdkDisplay * gsk_gpu_device_get_display (GskGpuDevice *self);
|
2023-10-12 21:53:12 +00:00
|
|
|
gsize gsk_gpu_device_get_max_image_size (GskGpuDevice *self);
|
2023-11-04 18:38:21 +00:00
|
|
|
GskGpuImage * gsk_gpu_device_get_atlas_image (GskGpuDevice *self);
|
2023-08-12 20:10:16 +00:00
|
|
|
|
|
|
|
GskGpuImage * gsk_gpu_device_create_offscreen_image (GskGpuDevice *self,
|
2023-11-01 05:43:15 +00:00
|
|
|
gboolean with_mipmap,
|
2023-08-12 20:10:16 +00:00
|
|
|
GdkMemoryDepth depth,
|
|
|
|
gsize width,
|
|
|
|
gsize height);
|
|
|
|
GskGpuImage * gsk_gpu_device_create_upload_image (GskGpuDevice *self,
|
2023-11-01 05:43:15 +00:00
|
|
|
gboolean with_mipmap,
|
2023-08-12 20:10:16 +00:00
|
|
|
GdkMemoryFormat format,
|
|
|
|
gsize width,
|
2023-11-24 00:27:44 +00:00
|
|
|
gsize height);
|
|
|
|
GskGpuImage * gsk_gpu_device_create_download_image (GskGpuDevice *self,
|
|
|
|
GdkMemoryDepth depth,
|
|
|
|
gsize width,
|
2023-08-12 20:10:16 +00:00
|
|
|
gsize height);
|
|
|
|
|
2023-09-01 10:11:06 +00:00
|
|
|
GskGpuImage * gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
|
|
|
|
GdkTexture *texture,
|
|
|
|
gint64 timestamp);
|
|
|
|
void gsk_gpu_device_cache_texture_image (GskGpuDevice *self,
|
|
|
|
GdkTexture *texture,
|
|
|
|
gint64 timestamp,
|
|
|
|
GskGpuImage *image);
|
|
|
|
|
2023-09-06 00:11:39 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GSK_GPU_GLYPH_X_OFFSET_1 = 0x1,
|
|
|
|
GSK_GPU_GLYPH_X_OFFSET_2 = 0x2,
|
|
|
|
GSK_GPU_GLYPH_X_OFFSET_3 = 0x3,
|
|
|
|
GSK_GPU_GLYPH_Y_OFFSET_1 = 0x4,
|
|
|
|
GSK_GPU_GLYPH_Y_OFFSET_2 = 0x8,
|
|
|
|
GSK_GPU_GLYPH_Y_OFFSET_3 = 0xC
|
|
|
|
} GskGpuGlyphLookupFlags;
|
|
|
|
|
|
|
|
GskGpuImage * gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
|
|
|
GskGpuFrame *frame,
|
|
|
|
PangoFont *font,
|
|
|
|
PangoGlyph glyph,
|
|
|
|
GskGpuGlyphLookupFlags flags,
|
|
|
|
float scale,
|
|
|
|
graphene_rect_t *out_bounds,
|
|
|
|
graphene_point_t *out_origin);
|
|
|
|
|
|
|
|
|
2023-08-12 20:10:16 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskGpuDevice, g_object_unref)
|
|
|
|
|
|
|
|
G_END_DECLS
|