forked from AuroraMiddleware/gtk
Merge branch 'render-node-types' into 'master'
Turn GskRenderNode into a fundamental type See merge request GNOME/gtk!1649
This commit is contained in:
commit
53d74fd2dc
@ -557,4 +557,26 @@ struct _GdkKeymapKey
|
|||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* GDK_EXTERN_VAR:
|
||||||
|
*
|
||||||
|
* A macro to annotate extern variables so that they show up properly in
|
||||||
|
* Windows DLLs.
|
||||||
|
*/
|
||||||
|
#ifndef GDK_EXTERN_VAR
|
||||||
|
# ifdef G_PLATFORM_WIN32
|
||||||
|
# ifdef GTK_COMPILATION
|
||||||
|
# ifdef DLL_EXPORT
|
||||||
|
# define GDK_EXTERN_VAR __declspec(dllexport)
|
||||||
|
# else /* !DLL_EXPORT */
|
||||||
|
# define GDK_EXTERN_VAR extern
|
||||||
|
# endif /* !DLL_EXPORT */
|
||||||
|
# else /* !GTK_COMPILATION */
|
||||||
|
# define GDK_EXTERN_VAR extern __declspec(dllimport)
|
||||||
|
# endif /* !GTK_COMPILATION */
|
||||||
|
# else /* !G_PLATFORM_WIN32 */
|
||||||
|
# define GDK_EXTERN_VAR _GDK_EXTERN
|
||||||
|
# endif /* !G_PLATFORM_WIN32 */
|
||||||
|
#endif /* GDK_EXTERN_VAR */
|
||||||
|
|
||||||
#endif /* __GDK_TYPES_H__ */
|
#endif /* __GDK_TYPES_H__ */
|
||||||
|
@ -595,7 +595,7 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
|
|||||||
n = gsk_linear_gradient_node_get_n_color_stops (node);
|
n = gsk_linear_gradient_node_get_n_color_stops (node);
|
||||||
add_uint32 (nodes, n);
|
add_uint32 (nodes, n);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
add_color_stop (nodes, &gsk_linear_gradient_node_peek_color_stops (node)[i]);
|
add_color_stop (nodes, &gsk_linear_gradient_node_peek_color_stops (node, NULL)[i]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ node_sample_add (NodeSample *self,
|
|||||||
g_assert (node_type <= N_NODE_TYPES);
|
g_assert (node_type <= N_NODE_TYPES);
|
||||||
|
|
||||||
if (self->nodes[node_type].class_name == NULL)
|
if (self->nodes[node_type].class_name == NULL)
|
||||||
self->nodes[node_type].class_name = node->node_class->type_name;
|
self->nodes[node_type].class_name = g_type_name_from_instance ((GTypeInstance *) node);
|
||||||
|
|
||||||
self->nodes[node_type].count ++;
|
self->nodes[node_type].count ++;
|
||||||
self->count ++;
|
self->count ++;
|
||||||
|
@ -150,7 +150,7 @@ print_render_node_tree (GskRenderNode *root, int level)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_print ("%*s %s\n", level * INDENT, " ", root->node_class->type_name);
|
g_print ("%*s %s\n", level * INDENT, " ", g_type_name_from_instance ((GTypeInstance *) root));
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef INDENT
|
#undef INDENT
|
||||||
@ -623,7 +623,9 @@ render_fallback_node (GskGLRenderer *self,
|
|||||||
surface,
|
surface,
|
||||||
GL_NEAREST, GL_NEAREST);
|
GL_NEAREST, GL_NEAREST);
|
||||||
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
|
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
|
||||||
"Fallback %s %d", node->node_class->type_name, texture_id);
|
"Fallback %s %d",
|
||||||
|
g_type_name_from_instance ((GTypeInstance *) node),
|
||||||
|
texture_id);
|
||||||
|
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
cairo_surface_destroy (rendered_surface);
|
cairo_surface_destroy (rendered_surface);
|
||||||
@ -643,7 +645,7 @@ render_text_node (GskGLRenderer *self,
|
|||||||
gboolean force_color)
|
gboolean force_color)
|
||||||
{
|
{
|
||||||
const PangoFont *font = gsk_text_node_peek_font (node);
|
const PangoFont *font = gsk_text_node_peek_font (node);
|
||||||
const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node);
|
const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node, NULL);
|
||||||
const float text_scale = ops_get_scale (builder);
|
const float text_scale = ops_get_scale (builder);
|
||||||
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
||||||
const guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
const guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||||
@ -1106,7 +1108,7 @@ render_linear_gradient_node (GskGLRenderer *self,
|
|||||||
RenderOpBuilder *builder)
|
RenderOpBuilder *builder)
|
||||||
{
|
{
|
||||||
const int n_color_stops = MIN (8, gsk_linear_gradient_node_get_n_color_stops (node));
|
const int n_color_stops = MIN (8, gsk_linear_gradient_node_get_n_color_stops (node));
|
||||||
const GskColorStop *stops = gsk_linear_gradient_node_peek_color_stops (node);
|
const GskColorStop *stops = gsk_linear_gradient_node_peek_color_stops (node, NULL);
|
||||||
const graphene_point_t *start = gsk_linear_gradient_node_peek_start (node);
|
const graphene_point_t *start = gsk_linear_gradient_node_peek_start (node);
|
||||||
const graphene_point_t *end = gsk_linear_gradient_node_peek_end (node);
|
const graphene_point_t *end = gsk_linear_gradient_node_peek_end (node);
|
||||||
OpLinearGradient *op;
|
OpLinearGradient *op;
|
||||||
@ -3159,9 +3161,13 @@ add_offscreen_ops (GskGLRenderer *self,
|
|||||||
|
|
||||||
gsk_gl_driver_create_render_target (self->gl_driver, width, height, &texture_id, &render_target);
|
gsk_gl_driver_create_render_target (self->gl_driver, width, height, &texture_id, &render_target);
|
||||||
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
|
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
|
||||||
"Offscreen<%s> %d", child_node->node_class->type_name, texture_id);
|
"Offscreen<%s> %d",
|
||||||
gdk_gl_context_label_object_printf (self->gl_context, GL_FRAMEBUFFER, render_target,
|
g_type_name_from_instance ((GTypeInstance *) child_node),
|
||||||
"Offscreen<%s> FB %d", child_node->node_class->type_name, render_target);
|
texture_id);
|
||||||
|
gdk_gl_context_label_object_printf (self->gl_context, GL_FRAMEBUFFER, render_target,
|
||||||
|
"Offscreen<%s> FB %d",
|
||||||
|
g_type_name_from_instance ((GTypeInstance *) child_node),
|
||||||
|
render_target);
|
||||||
|
|
||||||
graphene_matrix_init_ortho (&item_proj,
|
graphene_matrix_init_ortho (&item_proj,
|
||||||
bounds->origin.x * scale,
|
bounds->origin.x * scale,
|
||||||
@ -3209,10 +3215,11 @@ add_offscreen_ops (GskGLRenderer *self,
|
|||||||
if (G_UNLIKELY (flags & DUMP_FRAMEBUFFER))
|
if (G_UNLIKELY (flags & DUMP_FRAMEBUFFER))
|
||||||
{
|
{
|
||||||
static int k;
|
static int k;
|
||||||
ops_dump_framebuffer (builder, g_strdup_printf ("%s_%p_%d.png",
|
ops_dump_framebuffer (builder,
|
||||||
child_node->node_class->type_name,
|
g_strdup_printf ("%s_%p_%d.png",
|
||||||
child_node,
|
g_type_name_from_instance ((GTypeInstance *) child_node),
|
||||||
k ++),
|
child_node,
|
||||||
|
k ++),
|
||||||
width, height);
|
width, height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3583,7 +3590,9 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
|||||||
|
|
||||||
gdk_gl_context_make_current (self->gl_context);
|
gdk_gl_context_make_current (self->gl_context);
|
||||||
gdk_gl_context_push_debug_group_printf (self->gl_context,
|
gdk_gl_context_push_debug_group_printf (self->gl_context,
|
||||||
"Render %s<%p> to texture", root->node_class->type_name, root);
|
"Render %s<%p> to texture",
|
||||||
|
g_type_name_from_instance ((GTypeInstance *) root),
|
||||||
|
root);
|
||||||
|
|
||||||
width = ceilf (viewport->size.width);
|
width = ceilf (viewport->size.width);
|
||||||
height = ceilf (viewport->size.height);
|
height = ceilf (viewport->size.height);
|
||||||
@ -3595,8 +3604,11 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
|||||||
glGenTextures (1, &texture_id);
|
glGenTextures (1, &texture_id);
|
||||||
glBindTexture (GL_TEXTURE_2D, texture_id);
|
glBindTexture (GL_TEXTURE_2D, texture_id);
|
||||||
|
|
||||||
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
|
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
|
||||||
"Texture %s<%p> %d", root->node_class->type_name, root, texture_id);
|
"Texture %s<%p> %d",
|
||||||
|
g_type_name_from_instance ((GTypeInstance *) root),
|
||||||
|
root,
|
||||||
|
texture_id);
|
||||||
|
|
||||||
if (gdk_gl_context_get_use_es (self->gl_context))
|
if (gdk_gl_context_get_use_es (self->gl_context))
|
||||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
@ -3605,8 +3617,11 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
|||||||
|
|
||||||
glGenFramebuffers (1, &fbo_id);
|
glGenFramebuffers (1, &fbo_id);
|
||||||
glBindFramebuffer (GL_FRAMEBUFFER, fbo_id);
|
glBindFramebuffer (GL_FRAMEBUFFER, fbo_id);
|
||||||
gdk_gl_context_label_object_printf (self->gl_context, GL_FRAMEBUFFER, fbo_id,
|
gdk_gl_context_label_object_printf (self->gl_context, GL_FRAMEBUFFER, fbo_id,
|
||||||
"FB %s<%p> %d", root->node_class->type_name, root, fbo_id);
|
"FB %s<%p> %d",
|
||||||
|
g_type_name_from_instance ((GTypeInstance *) root),
|
||||||
|
root,
|
||||||
|
fbo_id);
|
||||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_id, 0);
|
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_id, 0);
|
||||||
g_assert_cmphex (glCheckFramebufferStatus (GL_FRAMEBUFFER), ==, GL_FRAMEBUFFER_COMPLETE);
|
g_assert_cmphex (glCheckFramebufferStatus (GL_FRAMEBUFFER), ==, GL_FRAMEBUFFER_COMPLETE);
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@
|
|||||||
* @GSK_TEXT_NODE: A node containing a glyph string
|
* @GSK_TEXT_NODE: A node containing a glyph string
|
||||||
* @GSK_BLUR_NODE: A node that applies a blur
|
* @GSK_BLUR_NODE: A node that applies a blur
|
||||||
* @GSK_DEBUG_NODE: Debug information that does not affect the rendering
|
* @GSK_DEBUG_NODE: Debug information that does not affect the rendering
|
||||||
*
|
|
||||||
* The type of a node determines what the node is rendering.
|
* The type of a node determines what the node is rendering.
|
||||||
**/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GSK_NOT_A_RENDER_NODE = 0,
|
GSK_NOT_A_RENDER_NODE = 0,
|
||||||
GSK_CONTAINER_NODE,
|
GSK_CONTAINER_NODE,
|
||||||
|
@ -50,47 +50,297 @@
|
|||||||
|
|
||||||
#include <gobject/gvaluecollector.h>
|
#include <gobject/gvaluecollector.h>
|
||||||
|
|
||||||
|
G_DEFINE_QUARK (gsk-serialization-error-quark, gsk_serialization_error)
|
||||||
|
|
||||||
|
#define GSK_RENDER_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_RENDER_NODE, GskRenderNodeClass))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GskRenderNode: (ref-func gsk_render_node_ref) (unref-func gsk_render_node_unref)
|
* GskRenderNode: (ref-func gsk_render_node_ref) (unref-func gsk_render_node_unref)
|
||||||
*
|
*
|
||||||
* The `GskRenderNode` structure contains only private data.
|
* A node in the render tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
G_DEFINE_BOXED_TYPE (GskRenderNode, gsk_render_node,
|
static void
|
||||||
gsk_render_node_ref,
|
value_render_node_init (GValue *value)
|
||||||
gsk_render_node_unref)
|
{
|
||||||
|
value->data[0].v_pointer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
value_render_node_free_value (GValue *value)
|
||||||
|
{
|
||||||
|
if (value->data[0].v_pointer != NULL)
|
||||||
|
gsk_render_node_unref (value->data[0].v_pointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
value_render_node_copy_value (const GValue *src,
|
||||||
|
GValue *dst)
|
||||||
|
{
|
||||||
|
if (src->data[0].v_pointer != NULL)
|
||||||
|
dst->data[0].v_pointer = gsk_render_node_ref (src->data[0].v_pointer);
|
||||||
|
else
|
||||||
|
dst->data[0].v_pointer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gpointer
|
||||||
|
value_render_node_peek_pointer (const GValue *value)
|
||||||
|
{
|
||||||
|
return value->data[0].v_pointer;
|
||||||
|
}
|
||||||
|
|
||||||
G_DEFINE_QUARK (gsk-serialization-error-quark, gsk_serialization_error)
|
static char *
|
||||||
|
value_render_node_collect_value (GValue *value,
|
||||||
|
guint n_collect_values,
|
||||||
|
GTypeCValue *collect_values,
|
||||||
|
guint collect_flags)
|
||||||
|
{
|
||||||
|
GskRenderNode *node = collect_values[0].v_pointer;
|
||||||
|
|
||||||
|
if (node == NULL)
|
||||||
|
{
|
||||||
|
value->data[0].v_pointer = NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node->parent_instance.g_class == NULL)
|
||||||
|
return g_strconcat ("invalid unclassed GskRenderNode pointer for "
|
||||||
|
"value type '",
|
||||||
|
G_VALUE_TYPE_NAME (value),
|
||||||
|
"'",
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
value->data[0].v_pointer = gsk_render_node_ref (node);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
value_render_node_lcopy_value (const GValue *value,
|
||||||
|
guint n_collect_values,
|
||||||
|
GTypeCValue *collect_values,
|
||||||
|
guint collect_flags)
|
||||||
|
{
|
||||||
|
GskRenderNode **node_p = collect_values[0].v_pointer;
|
||||||
|
|
||||||
|
if (node_p == NULL)
|
||||||
|
return g_strconcat ("value location for '",
|
||||||
|
G_VALUE_TYPE_NAME (value),
|
||||||
|
"' passed as NULL",
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (value->data[0].v_pointer == NULL)
|
||||||
|
*node_p = NULL;
|
||||||
|
else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
|
||||||
|
*node_p = value->data[0].v_pointer;
|
||||||
|
else
|
||||||
|
*node_p = gsk_render_node_ref (value->data[0].v_pointer);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gsk_render_node_finalize (GskRenderNode *self)
|
gsk_render_node_finalize (GskRenderNode *self)
|
||||||
{
|
{
|
||||||
self->node_class->finalize (self);
|
g_type_free_instance ((GTypeInstance *) self);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (self);
|
static void
|
||||||
|
gsk_render_node_real_draw (GskRenderNode *node,
|
||||||
|
cairo_t *cr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gsk_render_node_real_can_diff (const GskRenderNode *node1,
|
||||||
|
const GskRenderNode *node2)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gsk_render_node_real_diff (GskRenderNode *node1,
|
||||||
|
GskRenderNode *node2,
|
||||||
|
cairo_region_t *region)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gsk_render_node_class_init (GskRenderNodeClass *klass)
|
||||||
|
{
|
||||||
|
klass->node_type = GSK_NOT_A_RENDER_NODE;
|
||||||
|
klass->finalize = gsk_render_node_finalize;
|
||||||
|
klass->draw = gsk_render_node_real_draw;
|
||||||
|
klass->can_diff = gsk_render_node_real_can_diff;
|
||||||
|
klass->diff = gsk_render_node_real_diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gsk_render_node_init (GskRenderNode *self)
|
||||||
|
{
|
||||||
|
g_atomic_ref_count_init (&self->ref_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
gsk_render_node_get_type (void)
|
||||||
|
{
|
||||||
|
static volatile gsize render_node_type__volatile;
|
||||||
|
|
||||||
|
if (g_once_init_enter (&render_node_type__volatile))
|
||||||
|
{
|
||||||
|
static const GTypeFundamentalInfo finfo = {
|
||||||
|
(G_TYPE_FLAG_CLASSED |
|
||||||
|
G_TYPE_FLAG_INSTANTIATABLE |
|
||||||
|
G_TYPE_FLAG_DERIVABLE |
|
||||||
|
G_TYPE_FLAG_DEEP_DERIVABLE),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const GTypeValueTable value_table = {
|
||||||
|
value_render_node_init,
|
||||||
|
value_render_node_free_value,
|
||||||
|
value_render_node_copy_value,
|
||||||
|
value_render_node_peek_pointer,
|
||||||
|
"p",
|
||||||
|
value_render_node_collect_value,
|
||||||
|
"p",
|
||||||
|
value_render_node_lcopy_value,
|
||||||
|
};
|
||||||
|
|
||||||
|
const GTypeInfo node_info = {
|
||||||
|
/* Class */
|
||||||
|
sizeof (GskRenderNodeClass),
|
||||||
|
(GBaseInitFunc) NULL,
|
||||||
|
(GBaseFinalizeFunc) NULL,
|
||||||
|
(GClassInitFunc) gsk_render_node_class_init,
|
||||||
|
(GClassFinalizeFunc) NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
/* Instance */
|
||||||
|
sizeof (GskRenderNode),
|
||||||
|
0,
|
||||||
|
(GInstanceInitFunc) gsk_render_node_init,
|
||||||
|
|
||||||
|
/* GValue */
|
||||||
|
&value_table,
|
||||||
|
};
|
||||||
|
|
||||||
|
GType render_node_type =
|
||||||
|
g_type_register_fundamental (g_type_fundamental_next (),
|
||||||
|
g_intern_static_string ("GskRenderNode"),
|
||||||
|
&node_info, &finfo,
|
||||||
|
G_TYPE_FLAG_ABSTRACT);
|
||||||
|
|
||||||
|
g_once_init_leave (&render_node_type__volatile, render_node_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return render_node_type__volatile;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GskRenderNodeType node_type;
|
||||||
|
|
||||||
|
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);
|
||||||
|
} RenderNodeClassData;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gsk_render_node_generic_class_init (gpointer g_class,
|
||||||
|
gpointer class_data)
|
||||||
|
{
|
||||||
|
GskRenderNodeClass *node_class = g_class;
|
||||||
|
RenderNodeClassData *node_data = class_data;
|
||||||
|
|
||||||
|
/* Mandatory */
|
||||||
|
node_class->node_type = node_data->node_type;
|
||||||
|
|
||||||
|
/* Optional */
|
||||||
|
if (node_data->finalize != NULL)
|
||||||
|
node_class->finalize = node_data->finalize;
|
||||||
|
if (node_data->can_diff != NULL)
|
||||||
|
node_class->can_diff = node_data->can_diff;
|
||||||
|
|
||||||
|
/* Mandatory */
|
||||||
|
node_class->draw = node_data->draw;
|
||||||
|
node_class->diff = node_data->diff;
|
||||||
|
|
||||||
|
g_free (node_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gsk_render_node_can_diff_true (const GskRenderNode *node1,
|
||||||
|
const GskRenderNode *node2)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
/*< private >
|
||||||
* gsk_render_node_new:
|
* gsk_render_node_type_register_static:
|
||||||
* @node_class: class structure for this node
|
* @node_name: the name of the node
|
||||||
|
* @node_info: type information of the node
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): the newly created #GskRenderNode
|
* Registers a new #GskRenderNode type for the given @node_name using
|
||||||
|
* the type information in @node_info.
|
||||||
|
*
|
||||||
|
* Returns: the newly registered GType
|
||||||
*/
|
*/
|
||||||
GskRenderNode *
|
GType
|
||||||
gsk_render_node_new (const GskRenderNodeClass *node_class, gsize extra_size)
|
gsk_render_node_type_register_static (const char *node_name,
|
||||||
|
const GskRenderNodeTypeInfo *node_info)
|
||||||
{
|
{
|
||||||
GskRenderNode *self;
|
GTypeInfo info;
|
||||||
|
|
||||||
g_return_val_if_fail (node_class != NULL, NULL);
|
info.class_size = sizeof (GskRenderNodeClass);
|
||||||
g_return_val_if_fail (node_class->node_type != GSK_NOT_A_RENDER_NODE, NULL);
|
info.base_init = NULL;
|
||||||
|
info.base_finalize = NULL;
|
||||||
|
info.class_init = gsk_render_node_generic_class_init;
|
||||||
|
info.class_finalize = NULL;
|
||||||
|
|
||||||
self = g_malloc0 (node_class->struct_size + extra_size);
|
/* Avoid having a class_init() and a class struct for every GskRenderNode,
|
||||||
|
* by passing the various virtual functions and class data when initializing
|
||||||
|
* the base class
|
||||||
|
*/
|
||||||
|
info.class_data = g_new (RenderNodeClassData, 1);
|
||||||
|
((RenderNodeClassData *) info.class_data)->node_type = node_info->node_type;
|
||||||
|
((RenderNodeClassData *) info.class_data)->finalize = node_info->finalize;
|
||||||
|
((RenderNodeClassData *) info.class_data)->draw = node_info->draw;
|
||||||
|
((RenderNodeClassData *) info.class_data)->can_diff = node_info->can_diff != NULL
|
||||||
|
? node_info->can_diff
|
||||||
|
: gsk_render_node_can_diff_true;
|
||||||
|
((RenderNodeClassData *) info.class_data)->diff = node_info->diff != NULL
|
||||||
|
? node_info->diff
|
||||||
|
: gsk_render_node_diff_impossible;
|
||||||
|
|
||||||
self->node_class = node_class;
|
info.instance_size = node_info->instance_size;
|
||||||
|
info.n_preallocs = 0;
|
||||||
|
info.instance_init = (GInstanceInitFunc) node_info->instance_init;
|
||||||
|
info.value_table = NULL;
|
||||||
|
|
||||||
self->ref_count = 1;
|
return g_type_register_static (GSK_TYPE_RENDER_NODE, node_name, &info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
/*< private >
|
||||||
|
* gsk_render_node_alloc:
|
||||||
|
* @node_type: the #GskRenderNodeType to instantiate
|
||||||
|
*
|
||||||
|
* Instantiates a new #GskRenderNode for the given @node_type.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full) (type GskRenderNode): the newly created #GskRenderNode
|
||||||
|
*/
|
||||||
|
gpointer
|
||||||
|
gsk_render_node_alloc (GskRenderNodeType node_type)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (node_type > GSK_NOT_A_RENDER_NODE, NULL);
|
||||||
|
g_return_val_if_fail (node_type < GSK_RENDER_NODE_TYPE_N_TYPES, NULL);
|
||||||
|
|
||||||
|
g_assert (gsk_render_node_types[node_type] != G_TYPE_INVALID);
|
||||||
|
return g_type_create_instance (gsk_render_node_types[node_type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +356,7 @@ gsk_render_node_ref (GskRenderNode *node)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (GSK_IS_RENDER_NODE (node), NULL);
|
g_return_val_if_fail (GSK_IS_RENDER_NODE (node), NULL);
|
||||||
|
|
||||||
g_atomic_int_inc (&node->ref_count);
|
g_atomic_ref_count_inc (&node->ref_count);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@ -125,10 +375,11 @@ gsk_render_node_unref (GskRenderNode *node)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (GSK_IS_RENDER_NODE (node));
|
g_return_if_fail (GSK_IS_RENDER_NODE (node));
|
||||||
|
|
||||||
if (g_atomic_int_dec_and_test (&node->ref_count))
|
if (g_atomic_ref_count_dec (&node->ref_count))
|
||||||
gsk_render_node_finalize (node);
|
GSK_RENDER_NODE_GET_CLASS (node)->finalize (node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gsk_render_node_get_node_type:
|
* gsk_render_node_get_node_type:
|
||||||
* @node: a #GskRenderNode
|
* @node: a #GskRenderNode
|
||||||
@ -142,14 +393,14 @@ gsk_render_node_get_node_type (GskRenderNode *node)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (GSK_IS_RENDER_NODE (node), GSK_NOT_A_RENDER_NODE);
|
g_return_val_if_fail (GSK_IS_RENDER_NODE (node), GSK_NOT_A_RENDER_NODE);
|
||||||
|
|
||||||
return node->node_class->node_type;
|
return GSK_RENDER_NODE_GET_CLASS (node)->node_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_PURE static inline
|
G_GNUC_PURE static inline
|
||||||
GskRenderNodeType
|
GskRenderNodeType
|
||||||
_gsk_render_node_get_node_type (const GskRenderNode *node)
|
_gsk_render_node_get_node_type (const GskRenderNode *node)
|
||||||
{
|
{
|
||||||
return node->node_class->node_type;
|
return GSK_RENDER_NODE_GET_CLASS (node)->node_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,9 +446,10 @@ gsk_render_node_draw (GskRenderNode *node,
|
|||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
|
|
||||||
GSK_NOTE (CAIRO, g_message ("Rendering node %s[%p]",
|
GSK_NOTE (CAIRO, g_message ("Rendering node %s[%p]",
|
||||||
node->node_class->type_name, node));
|
g_type_name_from_instance ((GTypeInstance *) node),
|
||||||
|
node));
|
||||||
|
|
||||||
node->node_class->draw (node, cr);
|
GSK_RENDER_NODE_GET_CLASS (node)->draw (node, cr);
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
if (GSK_DEBUG_CHECK (GEOMETRY))
|
if (GSK_DEBUG_CHECK (GEOMETRY))
|
||||||
@ -216,7 +468,7 @@ gsk_render_node_draw (GskRenderNode *node,
|
|||||||
if (cairo_status (cr))
|
if (cairo_status (cr))
|
||||||
{
|
{
|
||||||
g_warning ("drawing failure for render node %s: %s",
|
g_warning ("drawing failure for render node %s: %s",
|
||||||
node->node_class->type_name,
|
g_type_name_from_instance ((GTypeInstance *) node),
|
||||||
cairo_status_to_string (cairo_status (cr)));
|
cairo_status_to_string (cairo_status (cr)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,7 +497,7 @@ gsk_render_node_can_diff (const GskRenderNode *node1,
|
|||||||
if (_gsk_render_node_get_node_type (node1) != _gsk_render_node_get_node_type (node2))
|
if (_gsk_render_node_get_node_type (node1) != _gsk_render_node_get_node_type (node2))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return node1->node_class->can_diff (node1, node2);
|
return GSK_RENDER_NODE_GET_CLASS (node1)->can_diff (node1, node2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -299,7 +551,7 @@ gsk_render_node_diff (GskRenderNode *node1,
|
|||||||
if (_gsk_render_node_get_node_type (node1) != _gsk_render_node_get_node_type (node2))
|
if (_gsk_render_node_get_node_type (node1) != _gsk_render_node_get_node_type (node2))
|
||||||
return gsk_render_node_diff_impossible (node1, node2, region);
|
return gsk_render_node_diff_impossible (node1, node2, region);
|
||||||
|
|
||||||
return node1->node_class->diff (node1, node2, region);
|
return GSK_RENDER_NODE_GET_CLASS (node1)->diff (node1, node2, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,6 +99,52 @@ GskRenderNode * gsk_render_node_deserialize (GBytes
|
|||||||
GskParseErrorFunc error_func,
|
GskParseErrorFunc error_func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
#define GSK_TYPE_DEBUG_NODE (gsk_debug_node_get_type())
|
||||||
|
#define GSK_TYPE_COLOR_NODE (gsk_color_node_get_type())
|
||||||
|
#define GSK_TYPE_TEXTURE_NODE (gsk_texture_node_get_type())
|
||||||
|
#define GSK_TYPE_LINEAR_GRADIENT_NODE (gsk_linear_gradient_node_get_type())
|
||||||
|
#define GSK_TYPE_REPEATING_LINEAR_GRADIENT_NODE (gsk_repeating_linear_gradient_node_get_type())
|
||||||
|
#define GSK_TYPE_BORDER_NODE (gsk_border_node_get_type())
|
||||||
|
#define GSK_TYPE_INSET_SHADOW_NODE (gsk_inset_shadow_node_get_type())
|
||||||
|
#define GSK_TYPE_OUTSET_SHADOW_NODE (gsk_outset_shadow_node_get_type())
|
||||||
|
#define GSK_TYPE_CAIRO_NODE (gsk_cairo_node_get_type())
|
||||||
|
#define GSK_TYPE_CONTAINER_NODE (gsk_container_node_get_type())
|
||||||
|
#define GSK_TYPE_TRANSFORM_NODE (gsk_transform_node_get_type())
|
||||||
|
#define GSK_TYPE_OPACITY_NODE (gsk_opacity_node_get_type())
|
||||||
|
#define GSK_TYPE_COLOR_MATRIX_NODE (gsk_color_matrix_node_get_type())
|
||||||
|
#define GSK_TYPE_REPEAT_NODE (gsk_repeat_node_get_type())
|
||||||
|
#define GSK_TYPE_CLIP_NODE (gsk_clip_node_get_type())
|
||||||
|
#define GSK_TYPE_ROUNDED_CLIP_NODE (gsk_rounded_clip_node_get_type())
|
||||||
|
#define GSK_TYPE_SHADOW_NODE (gsk_shadow_node_get_type())
|
||||||
|
#define GSK_TYPE_BLEND_NODE (gsk_blend_node_get_type())
|
||||||
|
#define GSK_TYPE_CROSS_FADE_NODE (gsk_cross_fade_node_get_type())
|
||||||
|
#define GSK_TYPE_TEXT_NODE (gsk_text_node_get_type())
|
||||||
|
#define GSK_TYPE_BLUR_NODE (gsk_blur_node_get_type())
|
||||||
|
|
||||||
|
typedef struct _GskDebugNode GskDebugNode;
|
||||||
|
typedef struct _GskColorNode GskColorNode;
|
||||||
|
typedef struct _GskTextureNode GskTextureNode;
|
||||||
|
typedef struct _GskLinearGradientNode GskLinearGradientNode;
|
||||||
|
typedef struct _GskRepeatingLinearGradientNode GskRepeatingLinearGradientNode;
|
||||||
|
typedef struct _GskBorderNode GskBorderNode;
|
||||||
|
typedef struct _GskInsetShadowNode GskInsetShadowNode;
|
||||||
|
typedef struct _GskOutsetShadowNode GskOutsetShadowNode;
|
||||||
|
typedef struct _GskCairoNode GskCairoNode;
|
||||||
|
typedef struct _GskContainerNode GskContainerNode;
|
||||||
|
typedef struct _GskTransformNode GskTransformNode;
|
||||||
|
typedef struct _GskOpacityNode GskOpacityNode;
|
||||||
|
typedef struct _GskColorMatrixNode GskColorMatrixNode;
|
||||||
|
typedef struct _GskRepeatNode GskRepeatNode;
|
||||||
|
typedef struct _GskClipNode GskClipNode;
|
||||||
|
typedef struct _GskRoundedClipNode GskRoundedClipNode;
|
||||||
|
typedef struct _GskShadowNode GskShadowNode;
|
||||||
|
typedef struct _GskBlendNode GskBlendNode;
|
||||||
|
typedef struct _GskCrossFadeNode GskCrossFadeNode;
|
||||||
|
typedef struct _GskTextNode GskTextNode;
|
||||||
|
typedef struct _GskBlurNode GskBlurNode;
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_debug_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_debug_node_new (GskRenderNode *child,
|
GskRenderNode * gsk_debug_node_new (GskRenderNode *child,
|
||||||
char *message);
|
char *message);
|
||||||
@ -107,18 +153,24 @@ GskRenderNode * gsk_debug_node_get_child (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const char * gsk_debug_node_get_message (GskRenderNode *node);
|
const char * gsk_debug_node_get_message (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_color_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_color_node_new (const GdkRGBA *rgba,
|
GskRenderNode * gsk_color_node_new (const GdkRGBA *rgba,
|
||||||
const graphene_rect_t *bounds);
|
const graphene_rect_t *bounds);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const GdkRGBA * gsk_color_node_peek_color (GskRenderNode *node);
|
const GdkRGBA * gsk_color_node_peek_color (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_texture_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_texture_node_new (GdkTexture *texture,
|
GskRenderNode * gsk_texture_node_new (GdkTexture *texture,
|
||||||
const graphene_rect_t *bounds);
|
const graphene_rect_t *bounds);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkTexture * gsk_texture_node_get_texture (GskRenderNode *node);
|
GdkTexture * gsk_texture_node_get_texture (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_linear_gradient_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_linear_gradient_node_new (const graphene_rect_t *bounds,
|
GskRenderNode * gsk_linear_gradient_node_new (const graphene_rect_t *bounds,
|
||||||
const graphene_point_t *start,
|
const graphene_point_t *start,
|
||||||
@ -132,8 +184,11 @@ const graphene_point_t * gsk_linear_gradient_node_peek_end (GskRenderNo
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gsize gsk_linear_gradient_node_get_n_color_stops (GskRenderNode *node);
|
gsize gsk_linear_gradient_node_get_n_color_stops (GskRenderNode *node);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const GskColorStop * gsk_linear_gradient_node_peek_color_stops (GskRenderNode *node);
|
const GskColorStop * gsk_linear_gradient_node_peek_color_stops (GskRenderNode *node,
|
||||||
|
gsize *n_stops);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_repeating_linear_gradient_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_repeating_linear_gradient_node_new (const graphene_rect_t *bounds,
|
GskRenderNode * gsk_repeating_linear_gradient_node_new (const graphene_rect_t *bounds,
|
||||||
const graphene_point_t *start,
|
const graphene_point_t *start,
|
||||||
@ -141,6 +196,8 @@ GskRenderNode * gsk_repeating_linear_gradient_node_new (const graph
|
|||||||
const GskColorStop *color_stops,
|
const GskColorStop *color_stops,
|
||||||
gsize n_color_stops);
|
gsize n_color_stops);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_border_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_border_node_new (const GskRoundedRect *outline,
|
GskRenderNode * gsk_border_node_new (const GskRoundedRect *outline,
|
||||||
const float border_width[4],
|
const float border_width[4],
|
||||||
@ -152,7 +209,8 @@ const float * gsk_border_node_peek_widths (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const GdkRGBA * gsk_border_node_peek_colors (GskRenderNode *node);
|
const GdkRGBA * gsk_border_node_peek_colors (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_inset_shadow_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_inset_shadow_node_new (const GskRoundedRect *outline,
|
GskRenderNode * gsk_inset_shadow_node_new (const GskRoundedRect *outline,
|
||||||
const GdkRGBA *color,
|
const GdkRGBA *color,
|
||||||
@ -173,6 +231,8 @@ float gsk_inset_shadow_node_get_spread (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
float gsk_inset_shadow_node_get_blur_radius (GskRenderNode *node);
|
float gsk_inset_shadow_node_get_blur_radius (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_outset_shadow_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_outset_shadow_node_new (const GskRoundedRect *outline,
|
GskRenderNode * gsk_outset_shadow_node_new (const GskRoundedRect *outline,
|
||||||
const GdkRGBA *color,
|
const GdkRGBA *color,
|
||||||
@ -193,6 +253,8 @@ float gsk_outset_shadow_node_get_spread (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
float gsk_outset_shadow_node_get_blur_radius (GskRenderNode *node);
|
float gsk_outset_shadow_node_get_blur_radius (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_cairo_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_cairo_node_new (const graphene_rect_t *bounds);
|
GskRenderNode * gsk_cairo_node_new (const graphene_rect_t *bounds);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
@ -200,6 +262,8 @@ cairo_t * gsk_cairo_node_get_draw_context (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
cairo_surface_t * gsk_cairo_node_peek_surface (GskRenderNode *node);
|
cairo_surface_t * gsk_cairo_node_peek_surface (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_container_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_container_node_new (GskRenderNode **children,
|
GskRenderNode * gsk_container_node_new (GskRenderNode **children,
|
||||||
guint n_children);
|
guint n_children);
|
||||||
@ -209,6 +273,8 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
GskRenderNode * gsk_container_node_get_child (GskRenderNode *node,
|
GskRenderNode * gsk_container_node_get_child (GskRenderNode *node,
|
||||||
guint idx);
|
guint idx);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_transform_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_transform_node_new (GskRenderNode *child,
|
GskRenderNode * gsk_transform_node_new (GskRenderNode *child,
|
||||||
GskTransform *transform);
|
GskTransform *transform);
|
||||||
@ -217,6 +283,8 @@ GskRenderNode * gsk_transform_node_get_child (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskTransform * gsk_transform_node_get_transform (GskRenderNode *node);
|
GskTransform * gsk_transform_node_get_transform (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_opacity_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_opacity_node_new (GskRenderNode *child,
|
GskRenderNode * gsk_opacity_node_new (GskRenderNode *child,
|
||||||
float opacity);
|
float opacity);
|
||||||
@ -225,6 +293,8 @@ GskRenderNode * gsk_opacity_node_get_child (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
float gsk_opacity_node_get_opacity (GskRenderNode *node);
|
float gsk_opacity_node_get_opacity (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_color_matrix_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_color_matrix_node_new (GskRenderNode *child,
|
GskRenderNode * gsk_color_matrix_node_new (GskRenderNode *child,
|
||||||
const graphene_matrix_t *color_matrix,
|
const graphene_matrix_t *color_matrix,
|
||||||
@ -237,6 +307,8 @@ const graphene_matrix_t *
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const graphene_vec4_t * gsk_color_matrix_node_peek_color_offset (GskRenderNode *node);
|
const graphene_vec4_t * gsk_color_matrix_node_peek_color_offset (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_repeat_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_repeat_node_new (const graphene_rect_t *bounds,
|
GskRenderNode * gsk_repeat_node_new (const graphene_rect_t *bounds,
|
||||||
GskRenderNode *child,
|
GskRenderNode *child,
|
||||||
@ -246,6 +318,8 @@ GskRenderNode * gsk_repeat_node_get_child (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const graphene_rect_t * gsk_repeat_node_peek_child_bounds (GskRenderNode *node);
|
const graphene_rect_t * gsk_repeat_node_peek_child_bounds (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_clip_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_clip_node_new (GskRenderNode *child,
|
GskRenderNode * gsk_clip_node_new (GskRenderNode *child,
|
||||||
const graphene_rect_t *clip);
|
const graphene_rect_t *clip);
|
||||||
@ -254,7 +328,8 @@ GskRenderNode * gsk_clip_node_get_child (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const graphene_rect_t * gsk_clip_node_peek_clip (GskRenderNode *node);
|
const graphene_rect_t * gsk_clip_node_peek_clip (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_rounded_clip_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_rounded_clip_node_new (GskRenderNode *child,
|
GskRenderNode * gsk_rounded_clip_node_new (GskRenderNode *child,
|
||||||
const GskRoundedRect *clip);
|
const GskRoundedRect *clip);
|
||||||
@ -263,6 +338,8 @@ GskRenderNode * gsk_rounded_clip_node_get_child (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const GskRoundedRect * gsk_rounded_clip_node_peek_clip (GskRenderNode *node);
|
const GskRoundedRect * gsk_rounded_clip_node_peek_clip (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_shadow_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_shadow_node_new (GskRenderNode *child,
|
GskRenderNode * gsk_shadow_node_new (GskRenderNode *child,
|
||||||
const GskShadow *shadows,
|
const GskShadow *shadows,
|
||||||
@ -275,6 +352,8 @@ const GskShadow * gsk_shadow_node_peek_shadow (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gsize gsk_shadow_node_get_n_shadows (GskRenderNode *node);
|
gsize gsk_shadow_node_get_n_shadows (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_blend_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_blend_node_new (GskRenderNode *bottom,
|
GskRenderNode * gsk_blend_node_new (GskRenderNode *bottom,
|
||||||
GskRenderNode *top,
|
GskRenderNode *top,
|
||||||
@ -286,6 +365,8 @@ GskRenderNode * gsk_blend_node_get_top_child (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskBlendMode gsk_blend_node_get_blend_mode (GskRenderNode *node);
|
GskBlendMode gsk_blend_node_get_blend_mode (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_cross_fade_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_cross_fade_node_new (GskRenderNode *start,
|
GskRenderNode * gsk_cross_fade_node_new (GskRenderNode *start,
|
||||||
GskRenderNode *end,
|
GskRenderNode *end,
|
||||||
@ -297,6 +378,8 @@ GskRenderNode * gsk_cross_fade_node_get_end_child (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
float gsk_cross_fade_node_get_progress (GskRenderNode *node);
|
float gsk_cross_fade_node_get_progress (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_text_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_text_node_new (PangoFont *font,
|
GskRenderNode * gsk_text_node_new (PangoFont *font,
|
||||||
PangoGlyphString *glyphs,
|
PangoGlyphString *glyphs,
|
||||||
@ -308,12 +391,15 @@ gboolean gsk_text_node_has_color_glyphs (GskRenderNode
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
guint gsk_text_node_get_num_glyphs (GskRenderNode *node);
|
guint gsk_text_node_get_num_glyphs (GskRenderNode *node);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const PangoGlyphInfo *gsk_text_node_peek_glyphs (GskRenderNode *node);
|
const PangoGlyphInfo *gsk_text_node_peek_glyphs (GskRenderNode *node,
|
||||||
|
guint *n_glyphs);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const GdkRGBA * gsk_text_node_peek_color (GskRenderNode *node);
|
const GdkRGBA * gsk_text_node_peek_color (GskRenderNode *node);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
const graphene_point_t *gsk_text_node_get_offset (GskRenderNode *node);
|
const graphene_point_t *gsk_text_node_get_offset (GskRenderNode *node);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gsk_blur_node_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GskRenderNode * gsk_blur_node_new (GskRenderNode *child,
|
GskRenderNode * gsk_blur_node_new (GskRenderNode *child,
|
||||||
float radius);
|
float radius);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1973,9 +1973,9 @@ render_node_print (Printer *p,
|
|||||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||||
case GSK_LINEAR_GRADIENT_NODE:
|
case GSK_LINEAR_GRADIENT_NODE:
|
||||||
{
|
{
|
||||||
const guint n_stops = gsk_linear_gradient_node_get_n_color_stops (node);
|
const gsize n_stops = gsk_linear_gradient_node_get_n_color_stops (node);
|
||||||
const GskColorStop *stops = gsk_linear_gradient_node_peek_color_stops (node);
|
const GskColorStop *stops = gsk_linear_gradient_node_peek_color_stops (node, NULL);
|
||||||
int i;
|
gsize i;
|
||||||
|
|
||||||
if (gsk_render_node_get_node_type (node) == GSK_REPEATING_LINEAR_GRADIENT_NODE)
|
if (gsk_render_node_get_node_type (node) == GSK_REPEATING_LINEAR_GRADIENT_NODE)
|
||||||
start_node (p, "repeating-linear-gradient");
|
start_node (p, "repeating-linear-gradient");
|
||||||
@ -2229,7 +2229,7 @@ render_node_print (Printer *p,
|
|||||||
case GSK_TEXT_NODE:
|
case GSK_TEXT_NODE:
|
||||||
{
|
{
|
||||||
const guint n_glyphs = gsk_text_node_get_num_glyphs (node);
|
const guint n_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||||
const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node);
|
const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node, NULL);
|
||||||
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
||||||
const GdkRGBA *color = gsk_text_node_peek_color (node);
|
const GdkRGBA *color = gsk_text_node_peek_color (node);
|
||||||
PangoFont *font = gsk_text_node_peek_font (node);
|
PangoFont *font = gsk_text_node_peek_font (node);
|
||||||
@ -2449,7 +2449,7 @@ render_node_print (Printer *p,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_error ("Unhandled node: %s", node->node_class->type_name);
|
g_error ("Unhandled node: %s", g_type_name_from_instance ((GTypeInstance *) node));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,22 +8,32 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
typedef struct _GskRenderNodeClass GskRenderNodeClass;
|
typedef struct _GskRenderNodeClass GskRenderNodeClass;
|
||||||
|
|
||||||
#define GSK_IS_RENDER_NODE_TYPE(node,type) (GSK_IS_RENDER_NODE (node) && (node)->node_class->node_type == (type))
|
/* 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.
|
||||||
|
*/
|
||||||
|
#define GSK_RENDER_NODE_TYPE_N_TYPES (GSK_DEBUG_NODE + 1)
|
||||||
|
|
||||||
|
extern GType gsk_render_node_types[];
|
||||||
|
|
||||||
|
#define GSK_IS_RENDER_NODE_TYPE(node,type) \
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((node), GSK_TYPE_RENDER_NODE, GskRenderNodeClass)->node_type == (type))
|
||||||
|
|
||||||
struct _GskRenderNode
|
struct _GskRenderNode
|
||||||
{
|
{
|
||||||
const GskRenderNodeClass *node_class;
|
GTypeInstance parent_instance;
|
||||||
|
|
||||||
volatile int ref_count;
|
gatomicrefcount ref_count;
|
||||||
|
|
||||||
graphene_rect_t bounds;
|
graphene_rect_t bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GskRenderNodeClass
|
struct _GskRenderNodeClass
|
||||||
{
|
{
|
||||||
|
GTypeClass parent_class;
|
||||||
|
|
||||||
GskRenderNodeType node_type;
|
GskRenderNodeType node_type;
|
||||||
gsize struct_size;
|
|
||||||
const char *type_name;
|
|
||||||
|
|
||||||
void (* finalize) (GskRenderNode *node);
|
void (* finalize) (GskRenderNode *node);
|
||||||
void (* draw) (GskRenderNode *node,
|
void (* draw) (GskRenderNode *node,
|
||||||
@ -35,18 +45,54 @@ struct _GskRenderNodeClass
|
|||||||
cairo_region_t *region);
|
cairo_region_t *region);
|
||||||
};
|
};
|
||||||
|
|
||||||
GskRenderNode * gsk_render_node_new (const GskRenderNodeClass *node_class,
|
/*< private >
|
||||||
gsize extra_size);
|
* GskRenderNodeTypeInfo:
|
||||||
|
* @node_type: the render node type in the #GskRenderNodeType enumeration
|
||||||
|
* @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
|
||||||
|
*
|
||||||
|
* A struction that contains the type information for a #GskRenderNode subclass,
|
||||||
|
* to be used by gsk_render_node_type_register_static().
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GskRenderNodeType node_type;
|
||||||
|
|
||||||
gboolean gsk_render_node_can_diff (const GskRenderNode *node1,
|
gsize instance_size;
|
||||||
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);
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
gpointer gsk_render_node_alloc (GskRenderNodeType node_type);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ gsk_public_headers = files([
|
|||||||
])
|
])
|
||||||
install_headers(gsk_public_headers, 'gsk.h', subdir: 'gtk-4.0/gsk')
|
install_headers(gsk_public_headers, 'gsk.h', subdir: 'gtk-4.0/gsk')
|
||||||
|
|
||||||
|
|
||||||
gsk_public_gl_headers = files([
|
gsk_public_gl_headers = files([
|
||||||
'gl/gskglrenderer.h'
|
'gl/gskglrenderer.h'
|
||||||
])
|
])
|
||||||
@ -69,14 +70,20 @@ gsk_public_headers += gsk_public_gl_headers
|
|||||||
gsk_public_broadway_headers = files([
|
gsk_public_broadway_headers = files([
|
||||||
'broadway/gskbroadwayrenderer.h'
|
'broadway/gskbroadwayrenderer.h'
|
||||||
])
|
])
|
||||||
install_headers(gsk_public_broadway_headers, subdir: 'gtk-4.0/gsk/broadway')
|
|
||||||
gsk_public_headers += gsk_public_broadway_headers
|
if get_variable('broadway_enabled')
|
||||||
|
install_headers(gsk_public_broadway_headers, subdir: 'gtk-4.0/gsk/broadway')
|
||||||
|
gsk_public_headers += gsk_public_broadway_headers
|
||||||
|
endif
|
||||||
|
|
||||||
gsk_public_vulkan_headers = files([
|
gsk_public_vulkan_headers = files([
|
||||||
'vulkan/gskvulkanrenderer.h'
|
'vulkan/gskvulkanrenderer.h'
|
||||||
])
|
])
|
||||||
install_headers(gsk_public_vulkan_headers, subdir: 'gtk-4.0/gsk/vulkan')
|
|
||||||
gsk_public_headers += gsk_public_vulkan_headers
|
if have_vulkan
|
||||||
|
install_headers(gsk_public_vulkan_headers, subdir: 'gtk-4.0/gsk/vulkan')
|
||||||
|
gsk_public_headers += gsk_public_vulkan_headers
|
||||||
|
endif
|
||||||
|
|
||||||
gsk_private_vulkan_shaders = []
|
gsk_private_vulkan_shaders = []
|
||||||
# This is an odd split because we use configure_file() below to workaround
|
# This is an odd split because we use configure_file() below to workaround
|
||||||
|
@ -258,7 +258,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
|||||||
return;
|
return;
|
||||||
case GSK_SHADOW_NODE:
|
case GSK_SHADOW_NODE:
|
||||||
default:
|
default:
|
||||||
FALLBACK ("Unsupported node '%s'", node->node_class->type_name);
|
FALLBACK ("Unsupported node '%s'", g_type_name_from_instance ((GTypeInstance *) node));
|
||||||
|
|
||||||
case GSK_REPEAT_NODE:
|
case GSK_REPEAT_NODE:
|
||||||
if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
|
if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
|
||||||
@ -346,7 +346,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
|||||||
case GSK_TEXT_NODE:
|
case GSK_TEXT_NODE:
|
||||||
{
|
{
|
||||||
const PangoFont *font = gsk_text_node_peek_font (node);
|
const PangoFont *font = gsk_text_node_peek_font (node);
|
||||||
const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node);
|
const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node, NULL);
|
||||||
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||||
gboolean has_color_glyphs = gsk_text_node_has_color_glyphs (node);
|
gboolean has_color_glyphs = gsk_text_node_has_color_glyphs (node);
|
||||||
int i;
|
int i;
|
||||||
@ -817,7 +817,7 @@ gsk_vulkan_render_pass_upload_fallback (GskVulkanRenderPass *self,
|
|||||||
g_message ("Upload op=%s, node %s[%p], bounds %gx%g",
|
g_message ("Upload op=%s, node %s[%p], bounds %gx%g",
|
||||||
op->type == GSK_VULKAN_OP_FALLBACK_CLIP ? "fallback-clip" :
|
op->type == GSK_VULKAN_OP_FALLBACK_CLIP ? "fallback-clip" :
|
||||||
(op->type == GSK_VULKAN_OP_FALLBACK_ROUNDED_CLIP ? "fallback-rounded-clip" : "fallback"),
|
(op->type == GSK_VULKAN_OP_FALLBACK_ROUNDED_CLIP ? "fallback-rounded-clip" : "fallback"),
|
||||||
node->node_class->type_name, node,
|
g_type_name_from_instance ((GTypeInstance *) node), node,
|
||||||
ceil (node->bounds.size.width),
|
ceil (node->bounds.size.width),
|
||||||
ceil (node->bounds.size.height)));
|
ceil (node->bounds.size.height)));
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
@ -1195,7 +1195,7 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
|
|||||||
&op->text.node->bounds,
|
&op->text.node->bounds,
|
||||||
(PangoFont *)gsk_text_node_peek_font (op->text.node),
|
(PangoFont *)gsk_text_node_peek_font (op->text.node),
|
||||||
gsk_text_node_get_num_glyphs (op->text.node),
|
gsk_text_node_get_num_glyphs (op->text.node),
|
||||||
gsk_text_node_peek_glyphs (op->text.node),
|
gsk_text_node_peek_glyphs (op->text.node, NULL),
|
||||||
gsk_text_node_peek_color (op->text.node),
|
gsk_text_node_peek_color (op->text.node),
|
||||||
gsk_text_node_get_offset (op->text.node),
|
gsk_text_node_get_offset (op->text.node),
|
||||||
op->text.start_glyph,
|
op->text.start_glyph,
|
||||||
@ -1214,7 +1214,7 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
|
|||||||
&op->text.node->bounds,
|
&op->text.node->bounds,
|
||||||
(PangoFont *)gsk_text_node_peek_font (op->text.node),
|
(PangoFont *)gsk_text_node_peek_font (op->text.node),
|
||||||
gsk_text_node_get_num_glyphs (op->text.node),
|
gsk_text_node_get_num_glyphs (op->text.node),
|
||||||
gsk_text_node_peek_glyphs (op->text.node),
|
gsk_text_node_peek_glyphs (op->text.node, NULL),
|
||||||
gsk_text_node_get_offset (op->text.node),
|
gsk_text_node_get_offset (op->text.node),
|
||||||
op->text.start_glyph,
|
op->text.start_glyph,
|
||||||
op->text.num_glyphs,
|
op->text.num_glyphs,
|
||||||
@ -1244,7 +1244,7 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
|
|||||||
gsk_linear_gradient_node_peek_end (op->render.node),
|
gsk_linear_gradient_node_peek_end (op->render.node),
|
||||||
gsk_render_node_get_node_type (op->render.node) == GSK_REPEATING_LINEAR_GRADIENT_NODE,
|
gsk_render_node_get_node_type (op->render.node) == GSK_REPEATING_LINEAR_GRADIENT_NODE,
|
||||||
gsk_linear_gradient_node_get_n_color_stops (op->render.node),
|
gsk_linear_gradient_node_get_n_color_stops (op->render.node),
|
||||||
gsk_linear_gradient_node_peek_color_stops (op->render.node));
|
gsk_linear_gradient_node_peek_color_stops (op->render.node, NULL));
|
||||||
n_bytes += op->render.vertex_count;
|
n_bytes += op->render.vertex_count;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -43,28 +43,46 @@ for filename in in_files:
|
|||||||
for line in f:
|
for line in f:
|
||||||
line = line.rstrip('\n').rstrip('\r')
|
line = line.rstrip('\n').rstrip('\r')
|
||||||
# print line
|
# print line
|
||||||
match = re.search(r'\bg[tds]k_[a-zA-Z0-9_]*_get_type\b', line)
|
match = re.search(r'\bg[dst]k_[a-zA-Z0-9_]*_get_type\b', line)
|
||||||
if match:
|
if match:
|
||||||
func = match.group(0)
|
func = match.group(0)
|
||||||
if not func in funcs:
|
if not func in funcs:
|
||||||
funcs.append(func)
|
funcs.append(func)
|
||||||
if debug: print ('Found ', func)
|
if debug: print ('Found ', func)
|
||||||
|
|
||||||
file_output = 'G_GNUC_BEGIN_IGNORE_DEPRECATIONS\n'
|
file_output = ['G_GNUC_BEGIN_IGNORE_DEPRECATIONS']
|
||||||
|
|
||||||
funcs = sorted(funcs)
|
funcs = sorted(funcs)
|
||||||
|
|
||||||
for f in funcs:
|
for f in funcs:
|
||||||
if f.startswith('gdk_x11') or f.startswith('gtk_socket') or f.startswith('gtk_plug'):
|
if f.startswith('gdk_x11'):
|
||||||
file_output += '#ifdef GDK_WINDOWING_X11\n'
|
file_output += ['#ifdef GDK_WINDOWING_X11']
|
||||||
file_output += '*tp++ = {0}();\n'.format(f)
|
file_output += ['*tp++ = {0}();'.format(f)]
|
||||||
file_output += '#endif\n'
|
file_output += ['#endif']
|
||||||
|
elif f.startswith('gdk_broadway'):
|
||||||
|
file_output += ['#ifdef GDK_WINDOWING_BROADWAY']
|
||||||
|
file_output += ['*tp++ = {0}();'.format(f)]
|
||||||
|
file_output += ['#endif']
|
||||||
|
elif f.startswith('gdk_wayland'):
|
||||||
|
file_output += ['#ifdef GDK_WINDOWING_WAYLAND']
|
||||||
|
file_output += ['*tp++ = {0}();'.format(f)]
|
||||||
|
file_output += ['#endif']
|
||||||
|
elif f.startswith('gdk_win32'):
|
||||||
|
file_output += ['#ifdef GDK_WINDOWING_WIN32']
|
||||||
|
file_output += ['*tp++ = {0}();'.format(f)]
|
||||||
|
file_output += ['#endif']
|
||||||
|
elif f.startswith('gdk_quartz'):
|
||||||
|
file_output += ['#ifdef GDK_WINDOWING_QUARTZ']
|
||||||
|
file_output += ['*tp++ = {0}();'.format(f)]
|
||||||
|
file_output += ['#endif']
|
||||||
else:
|
else:
|
||||||
file_output += '*tp++ = {0}();\n'.format(f)
|
file_output += ['*tp++ = {0}();'.format(f)]
|
||||||
|
|
||||||
|
file_output += ['G_GNUC_END_IGNORE_DEPRECATIONS']
|
||||||
|
|
||||||
if debug: print (len(funcs), 'functions')
|
if debug: print (len(funcs), 'functions')
|
||||||
|
|
||||||
tmp_file = out_file + '~'
|
tmp_file = out_file + '~'
|
||||||
with open(tmp_file, 'w') as f:
|
with open(tmp_file, 'w') as f:
|
||||||
f.write(file_output)
|
f.write('\n'.join(file_output))
|
||||||
replace_if_changed(tmp_file, out_file)
|
replace_if_changed(tmp_file, out_file)
|
||||||
|
@ -95,6 +95,7 @@
|
|||||||
#include "gdk/gdk.h"
|
#include "gdk/gdk.h"
|
||||||
#include "gdk/gdk-private.h"
|
#include "gdk/gdk-private.h"
|
||||||
#include "gsk/gskprivate.h"
|
#include "gsk/gskprivate.h"
|
||||||
|
#include "gsk/gskrendernodeprivate.h"
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
@ -660,6 +661,7 @@ do_post_parse_initialization (void)
|
|||||||
gtk_widget_set_default_direction (gtk_get_locale_direction ());
|
gtk_widget_set_default_direction (gtk_get_locale_direction ());
|
||||||
|
|
||||||
gsk_ensure_resources ();
|
gsk_ensure_resources ();
|
||||||
|
gsk_render_node_init_types ();
|
||||||
_gtk_ensure_resources ();
|
_gtk_ensure_resources ();
|
||||||
|
|
||||||
gtk_initialized = TRUE;
|
gtk_initialized = TRUE;
|
||||||
|
@ -1152,7 +1152,7 @@ gtk_snapshot_pop_collect (GtkSnapshot *snapshot)
|
|||||||
* @snapshot. The only function that should be
|
* @snapshot. The only function that should be
|
||||||
* called after this is gtk_snapshot_unref().
|
* called after this is gtk_snapshot_unref().
|
||||||
*
|
*
|
||||||
* Returns: the constructed #GskRenderNode
|
* Returns: (transfer full): the constructed #GskRenderNode
|
||||||
*/
|
*/
|
||||||
GskRenderNode *
|
GskRenderNode *
|
||||||
gtk_snapshot_to_node (GtkSnapshot *snapshot)
|
gtk_snapshot_to_node (GtkSnapshot *snapshot)
|
||||||
|
@ -601,7 +601,7 @@ populate_render_node_properties (GtkListStore *store,
|
|||||||
const graphene_point_t *start = gsk_linear_gradient_node_peek_start (node);
|
const graphene_point_t *start = gsk_linear_gradient_node_peek_start (node);
|
||||||
const graphene_point_t *end = gsk_linear_gradient_node_peek_end (node);
|
const graphene_point_t *end = gsk_linear_gradient_node_peek_end (node);
|
||||||
const gsize n_stops = gsk_linear_gradient_node_get_n_color_stops (node);
|
const gsize n_stops = gsk_linear_gradient_node_get_n_color_stops (node);
|
||||||
const GskColorStop *stops = gsk_linear_gradient_node_peek_color_stops (node);
|
const GskColorStop *stops = gsk_linear_gradient_node_peek_color_stops (node, NULL);
|
||||||
int i;
|
int i;
|
||||||
GString *s;
|
GString *s;
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
@ -633,7 +633,7 @@ populate_render_node_properties (GtkListStore *store,
|
|||||||
case GSK_TEXT_NODE:
|
case GSK_TEXT_NODE:
|
||||||
{
|
{
|
||||||
const PangoFont *font = gsk_text_node_peek_font (node);
|
const PangoFont *font = gsk_text_node_peek_font (node);
|
||||||
const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node);
|
const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node, NULL);
|
||||||
const GdkRGBA *color = gsk_text_node_peek_color (node);
|
const GdkRGBA *color = gsk_text_node_peek_color (node);
|
||||||
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||||
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
||||||
|
Loading…
Reference in New Issue
Block a user