2023-03-31 19:11:10 +00:00
|
|
|
#pragma once
|
2016-11-07 16:59:38 +00:00
|
|
|
|
2017-11-02 20:39:00 +00:00
|
|
|
#include "gdktexture.h"
|
2016-11-07 16:59:38 +00:00
|
|
|
|
2021-10-25 00:14:18 +00:00
|
|
|
#include "gdkenums.h"
|
2024-06-28 04:12:27 +00:00
|
|
|
#include "gdkmemoryformatprivate.h"
|
2021-10-25 00:14:18 +00:00
|
|
|
|
2016-11-07 16:59:38 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2023-12-04 15:18:58 +00:00
|
|
|
typedef struct _GdkTextureChain GdkTextureChain;
|
|
|
|
|
|
|
|
struct _GdkTextureChain
|
|
|
|
{
|
|
|
|
gatomicrefcount ref_count;
|
|
|
|
GMutex lock;
|
|
|
|
};
|
|
|
|
|
2017-11-02 20:39:00 +00:00
|
|
|
#define GDK_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_TEXTURE, GdkTextureClass))
|
|
|
|
#define GDK_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_TEXTURE))
|
|
|
|
#define GDK_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_TEXTURE, GdkTextureClass))
|
2016-11-07 16:59:38 +00:00
|
|
|
|
2017-11-02 20:39:00 +00:00
|
|
|
struct _GdkTexture
|
2016-11-07 16:59:38 +00:00
|
|
|
{
|
2017-01-01 12:40:13 +00:00
|
|
|
GObject parent_instance;
|
2016-11-07 16:59:38 +00:00
|
|
|
|
2021-10-07 00:41:30 +00:00
|
|
|
GdkMemoryFormat format;
|
2016-11-07 16:59:38 +00:00
|
|
|
int width;
|
|
|
|
int height;
|
2024-06-17 17:10:56 +00:00
|
|
|
GdkColorState *color_state;
|
2016-11-16 04:37:20 +00:00
|
|
|
|
|
|
|
gpointer render_key;
|
|
|
|
gpointer render_data;
|
|
|
|
GDestroyNotify render_notify;
|
2023-04-27 22:12:49 +00:00
|
|
|
|
|
|
|
/* for diffing swapchain-like textures.
|
2023-12-04 15:18:58 +00:00
|
|
|
* Textures in the same chain are connected in a double linked list which is
|
|
|
|
* protected using the chain's shared mutex.
|
|
|
|
*/
|
|
|
|
GdkTextureChain *chain; /* lazy, atomic, shared by all chain links */
|
|
|
|
GdkTexture *next_texture; /* no reference, guarded by chain lock */
|
|
|
|
GdkTexture *previous_texture; /* no reference, guarded by chain lock */
|
|
|
|
cairo_region_t *diff_to_previous; /* guarded by chain lock */
|
2016-11-07 16:59:38 +00:00
|
|
|
};
|
|
|
|
|
2017-11-02 20:39:00 +00:00
|
|
|
struct _GdkTextureClass {
|
2017-01-01 12:40:13 +00:00
|
|
|
GObjectClass parent_class;
|
2016-11-16 03:14:32 +00:00
|
|
|
|
2021-10-07 04:19:41 +00:00
|
|
|
/* mandatory: Download in the given format into data */
|
2017-11-02 20:39:00 +00:00
|
|
|
void (* download) (GdkTexture *texture,
|
2021-10-07 04:19:41 +00:00
|
|
|
GdkMemoryFormat format,
|
2024-07-13 22:51:05 +00:00
|
|
|
GdkColorState *color_state,
|
2016-12-21 21:11:52 +00:00
|
|
|
guchar *data,
|
|
|
|
gsize stride);
|
2016-11-16 03:14:32 +00:00
|
|
|
};
|
|
|
|
|
2021-09-14 15:40:09 +00:00
|
|
|
gboolean gdk_texture_can_load (GBytes *bytes);
|
|
|
|
|
2017-11-02 20:39:00 +00:00
|
|
|
GdkTexture * gdk_texture_new_for_surface (cairo_surface_t *surface);
|
2024-07-02 01:09:44 +00:00
|
|
|
cairo_surface_t * gdk_texture_download_surface (GdkTexture *texture,
|
|
|
|
GdkColorState *color_state);
|
2016-11-07 16:59:38 +00:00
|
|
|
|
2024-06-28 04:12:27 +00:00
|
|
|
GdkMemoryDepth gdk_texture_get_depth (GdkTexture *self);
|
|
|
|
|
2021-10-07 04:19:41 +00:00
|
|
|
void gdk_texture_do_download (GdkTexture *texture,
|
|
|
|
GdkMemoryFormat format,
|
2024-07-13 22:51:05 +00:00
|
|
|
GdkColorState *color_state,
|
2021-10-07 04:19:41 +00:00
|
|
|
guchar *data,
|
|
|
|
gsize stride);
|
2023-04-27 22:12:49 +00:00
|
|
|
void gdk_texture_diff (GdkTexture *self,
|
|
|
|
GdkTexture *other,
|
|
|
|
cairo_region_t *region);
|
|
|
|
|
|
|
|
void gdk_texture_set_diff (GdkTexture *self,
|
|
|
|
GdkTexture *previous,
|
|
|
|
cairo_region_t *diff);
|
|
|
|
|
2017-11-02 20:39:00 +00:00
|
|
|
gboolean gdk_texture_set_render_data (GdkTexture *self,
|
2016-11-16 04:37:20 +00:00
|
|
|
gpointer key,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify notify);
|
2024-07-06 14:55:48 +00:00
|
|
|
void gdk_texture_steal_render_data (GdkTexture *self);
|
2017-11-02 20:39:00 +00:00
|
|
|
void gdk_texture_clear_render_data (GdkTexture *self);
|
|
|
|
gpointer gdk_texture_get_render_data (GdkTexture *self,
|
2016-11-16 04:37:20 +00:00
|
|
|
gpointer key);
|
|
|
|
|
2016-11-07 16:59:38 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|