2016-03-17 13:48:19 +00:00
|
|
|
#ifndef __GSK_RENDER_NODE_PRIVATE_H__
|
|
|
|
#define __GSK_RENDER_NODE_PRIVATE_H__
|
|
|
|
|
|
|
|
#include "gskrendernode.h"
|
|
|
|
#include <cairo.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2016-12-11 02:57:42 +00:00
|
|
|
typedef struct _GskRenderNodeClass GskRenderNodeClass;
|
|
|
|
|
2020-04-07 22:33:54 +00:00
|
|
|
/* Keep this in sync with the GskRenderNodeType enumeration.
|
|
|
|
*
|
|
|
|
* We don't add an "n-types" value to avoid having to handle
|
|
|
|
* it in every single switch.
|
|
|
|
*/
|
2020-09-18 15:46:57 +00:00
|
|
|
#define GSK_RENDER_NODE_TYPE_N_TYPES (GSK_GL_SHADER_NODE + 1)
|
2020-04-07 22:33:54 +00:00
|
|
|
|
2020-04-08 14:34:11 +00:00
|
|
|
extern GType gsk_render_node_types[];
|
|
|
|
|
2020-04-07 22:33:54 +00:00
|
|
|
#define GSK_IS_RENDER_NODE_TYPE(node,type) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((node), GSK_TYPE_RENDER_NODE, GskRenderNodeClass)->node_type == (type))
|
2016-12-11 02:57:42 +00:00
|
|
|
|
2016-03-17 13:48:19 +00:00
|
|
|
struct _GskRenderNode
|
|
|
|
{
|
2020-04-07 22:33:54 +00:00
|
|
|
GTypeInstance parent_instance;
|
2016-12-10 20:42:01 +00:00
|
|
|
|
2020-04-07 22:33:54 +00:00
|
|
|
gatomicrefcount ref_count;
|
2016-03-17 13:48:19 +00:00
|
|
|
|
2016-12-21 10:21:38 +00:00
|
|
|
graphene_rect_t bounds;
|
2021-10-01 20:23:12 +00:00
|
|
|
|
|
|
|
guint prefers_high_depth : 1;
|
2016-03-17 13:48:19 +00:00
|
|
|
};
|
|
|
|
|
2016-12-11 02:57:42 +00:00
|
|
|
struct _GskRenderNodeClass
|
|
|
|
{
|
2020-04-07 22:33:54 +00:00
|
|
|
GTypeClass parent_class;
|
|
|
|
|
2016-12-11 02:57:42 +00:00
|
|
|
GskRenderNodeType node_type;
|
2017-01-17 23:05:25 +00:00
|
|
|
|
2017-10-20 06:06:20 +00:00
|
|
|
void (* finalize) (GskRenderNode *node);
|
|
|
|
void (* draw) (GskRenderNode *node,
|
|
|
|
cairo_t *cr);
|
2020-01-24 12:17:09 +00:00
|
|
|
gboolean (* can_diff) (const GskRenderNode *node1,
|
|
|
|
const GskRenderNode *node2);
|
2018-03-20 00:37:05 +00:00
|
|
|
void (* diff) (GskRenderNode *node1,
|
|
|
|
GskRenderNode *node2,
|
|
|
|
cairo_region_t *region);
|
2017-10-20 06:06:20 +00:00
|
|
|
};
|
2016-08-24 13:07:26 +00:00
|
|
|
|
2020-04-07 22:33:54 +00:00
|
|
|
/*< private >
|
|
|
|
* GskRenderNodeTypeInfo:
|
2021-05-20 03:40:54 +00:00
|
|
|
* @node_type: the render node type in the `GskRenderNodeType` enumeration
|
2020-04-07 22:33:54 +00:00
|
|
|
* @instance_size: the size of the render node instance
|
|
|
|
* @instance_init: (nullable): the instance initialization function
|
|
|
|
* @finalize: (nullable): the instance finalization function; must chain up to the
|
|
|
|
* implementation of the parent class
|
|
|
|
* @draw: the function called by gsk_render_node_draw()
|
|
|
|
* @can_diff: (nullable): the function called by gsk_render_node_can_diff(); if
|
|
|
|
* unset, gsk_render_node_can_diff_true() will be used
|
|
|
|
* @diff: (nullable): the function called by gsk_render_node_diff(); if unset,
|
|
|
|
* gsk_render_node_diff_impossible() will be used
|
|
|
|
*
|
2021-05-20 03:40:54 +00:00
|
|
|
* A struction that contains the type information for a `GskRenderNode` subclass,
|
2020-04-07 22:33:54 +00:00
|
|
|
* to be used by gsk_render_node_type_register_static().
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GskRenderNodeType node_type;
|
|
|
|
|
|
|
|
gsize instance_size;
|
|
|
|
|
|
|
|
void (* instance_init) (GskRenderNode *node);
|
|
|
|
void (* finalize) (GskRenderNode *node);
|
|
|
|
void (* draw) (GskRenderNode *node,
|
|
|
|
cairo_t *cr);
|
|
|
|
gboolean (* can_diff) (const GskRenderNode *node1,
|
|
|
|
const GskRenderNode *node2);
|
|
|
|
void (* diff) (GskRenderNode *node1,
|
|
|
|
GskRenderNode *node2,
|
|
|
|
cairo_region_t *region);
|
|
|
|
} GskRenderNodeTypeInfo;
|
|
|
|
|
|
|
|
void gsk_render_node_init_types (void);
|
|
|
|
|
|
|
|
GType gsk_render_node_type_register_static (const char *node_name,
|
|
|
|
const GskRenderNodeTypeInfo *node_info);
|
2016-12-17 06:44:10 +00:00
|
|
|
|
2020-04-07 22:33:54 +00:00
|
|
|
gpointer gsk_render_node_alloc (GskRenderNodeType node_type);
|
2018-03-20 00:37:05 +00:00
|
|
|
|
2020-04-07 22:33:54 +00:00
|
|
|
gboolean gsk_render_node_can_diff (const GskRenderNode *node1,
|
|
|
|
const GskRenderNode *node2) G_GNUC_PURE;
|
|
|
|
void gsk_render_node_diff (GskRenderNode *node1,
|
|
|
|
GskRenderNode *node2,
|
|
|
|
cairo_region_t *region);
|
|
|
|
void gsk_render_node_diff_impossible (GskRenderNode *node1,
|
|
|
|
GskRenderNode *node2,
|
|
|
|
cairo_region_t *region);
|
2021-03-28 14:18:23 +00:00
|
|
|
void gsk_container_node_diff_with (GskRenderNode *container,
|
|
|
|
GskRenderNode *other,
|
|
|
|
cairo_region_t *region);
|
2018-04-21 09:20:15 +00:00
|
|
|
|
2021-02-03 22:49:42 +00:00
|
|
|
bool gsk_border_node_get_uniform (const GskRenderNode *self);
|
2021-03-09 02:36:41 +00:00
|
|
|
bool gsk_border_node_get_uniform_color (const GskRenderNode *self);
|
2020-07-24 13:59:45 +00:00
|
|
|
|
2020-12-21 18:11:08 +00:00
|
|
|
void gsk_text_node_serialize_glyphs (GskRenderNode *self,
|
|
|
|
GString *str);
|
|
|
|
|
2021-07-24 13:49:09 +00:00
|
|
|
GskRenderNode ** gsk_container_node_get_children (const GskRenderNode *node,
|
|
|
|
guint *n_children);
|
|
|
|
|
2021-07-24 14:48:20 +00:00
|
|
|
void gsk_transform_node_get_translate (const GskRenderNode *node,
|
|
|
|
float *dx,
|
|
|
|
float *dy);
|
2021-10-01 20:23:12 +00:00
|
|
|
gboolean gsk_render_node_prefers_high_depth (const GskRenderNode *node);
|
2021-07-24 14:48:20 +00:00
|
|
|
|
2021-07-24 13:49:09 +00:00
|
|
|
|
2016-03-17 13:48:19 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GSK_RENDER_NODE_PRIVATE_H__ */
|