Merge branch 'wip/chergert/macos-perf-fixes' into 'master'

macos: various OpenGL performance fixes

See merge request GNOME/gtk!3170
This commit is contained in:
Matthias Clasen 2021-02-08 20:30:27 +00:00
commit 360a66e945
7 changed files with 267 additions and 369 deletions

View File

@ -73,23 +73,23 @@ void gdk_profiler_set_int_counter (guint id,
gint64 value);
#ifndef HAVE_SYSPROF
#define gdk_profiler_add_mark(b, d, n, m)
#define gdk_profiler_end_mark(b, n, m)
#define gdk_profiler_add_mark(b, d, n, m) G_STMT_START {} G_STMT_END
#define gdk_profiler_end_mark(b, n, m) G_STMT_START {} G_STMT_END
/* Optimise the whole call out */
#if defined(G_HAVE_ISO_VARARGS)
#define gdk_profiler_add_markf(b, d, n, m, ...)
#define gdk_profiler_end_markf(b, n, m, ...)
#define gdk_profiler_add_markf(b, d, n, m, ...) G_STMT_START {} G_STMT_END
#define gdk_profiler_end_markf(b, n, m, ...) G_STMT_START {} G_STMT_END
#elif defined(G_HAVE_GNUC_VARARGS)
#define gdk_profiler_add_markf(b, d, n, m...)
#define gdk_profiler_end_markf(b, n, m...)
#define gdk_profiler_add_markf(b, d, n, m...) G_STMT_START {} G_STMT_END
#define gdk_profiler_end_markf(b, n, m...) G_STMT_START {} G_STMT_END
#else
/* no varargs macro support; the call will have to be optimised out by the compiler */
#endif
#define gdk_profiler_define_counter(n, d) 0
#define gdk_profiler_define_int_counter(n, d) 0
#define gdk_profiler_set_counter(i, v)
#define gdk_profiler_set_int_counter(i, v)
#define gdk_profiler_set_counter(i, v) G_STMT_START {} G_STMT_END
#define gdk_profiler_set_int_counter(i, v) G_STMT_START {} G_STMT_END
#endif
G_END_DECLS

View File

@ -45,7 +45,6 @@ struct _GdkMacosGLContext
NSView *dummy_view;
cairo_region_t *damage;
cairo_rectangle_int_t flush_rect;
guint is_attached : 1;
guint needs_resize : 1;

View File

@ -136,7 +136,7 @@ ensure_gl_view (GdkMacosGLContext *self)
nsview = _gdk_macos_surface_get_view (surface);
nswindow = _gdk_macos_surface_get_native (surface);
if (!GDK_IS_MACOS_GL_VIEW (nsview))
if G_UNLIKELY (!GDK_IS_MACOS_GL_VIEW (nsview))
{
NSRect frame;
@ -278,6 +278,9 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
surface = gdk_draw_context_get_surface (context);
g_clear_pointer (&self->damage, cairo_region_destroy);
self->damage = cairo_region_copy (painted);
/* If begin frame is called, that means we are trying to draw to
* the NSWindow using our view. That might be a GdkMacosCairoView
* but we need it to be a GL view. Also, only in this case do we
@ -286,28 +289,7 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
*/
if (!self->is_attached &&
gdk_gl_context_get_shared_context (GDK_GL_CONTEXT (context)))
{
CGLContextObj glctx = [self->gl_context CGLContextObj];
GLint swapRect[4];
ensure_gl_view (self);
g_clear_pointer (&self->damage, cairo_region_destroy);
self->damage = cairo_region_copy (painted);
cairo_region_get_extents (painted, &self->flush_rect);
/* Coordinates are in display coordinates, where as flush_rect is
* in GDK coordinates. Must flip Y to match display coordinates where
* 0,0 is the bottom-left corner.
*/
swapRect[0] = self->flush_rect.x; /* left */
swapRect[1] = surface->height - self->flush_rect.y; /* bottom */
swapRect[2] = self->flush_rect.width; /* width */
swapRect[3] = self->flush_rect.height; /* height */
CGLSetParameter (glctx, kCGLCPSwapRectangle, swapRect);
}
ensure_gl_view (self);
if (self->needs_resize)
{
@ -362,7 +344,26 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->end_frame (context, painted);
[self->gl_context flushBuffer];
if (!self->is_attached)
{
GdkSurface *surface = gdk_draw_context_get_surface (context);
CGLContextObj glctx = [self->gl_context CGLContextObj];
cairo_rectangle_int_t flush_rect;
GLint swapRect[4];
/* Coordinates are in display coordinates, where as flush_rect is
* in GDK coordinates. Must flip Y to match display coordinates where
* 0,0 is the bottom-left corner.
*/
cairo_region_get_extents (painted, &flush_rect);
swapRect[0] = flush_rect.x; /* left */
swapRect[1] = surface->height - flush_rect.y; /* bottom */
swapRect[2] = flush_rect.width; /* width */
swapRect[3] = flush_rect.height; /* height */
CGLSetParameter (glctx, kCGLCPSwapRectangle, swapRect);
[self->gl_context flushBuffer];
}
}
static void

View File

@ -389,7 +389,7 @@ gsk_render_node_unref (GskRenderNode *node)
* Returns: the type of the #GskRenderNode
*/
GskRenderNodeType
gsk_render_node_get_node_type (GskRenderNode *node)
gsk_render_node_get_node_type (const GskRenderNode *node)
{
g_return_val_if_fail (GSK_IS_RENDER_NODE (node), GSK_NOT_A_RENDER_NODE);

View File

@ -118,7 +118,7 @@ GDK_AVAILABLE_IN_ALL
void gsk_render_node_unref (GskRenderNode *node);
GDK_AVAILABLE_IN_ALL
GskRenderNodeType gsk_render_node_get_node_type (GskRenderNode *node);
GskRenderNodeType gsk_render_node_get_node_type (const GskRenderNode *node);
GDK_AVAILABLE_IN_ALL
void gsk_render_node_get_bounds (GskRenderNode *node,
@ -197,9 +197,9 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_debug_node_new (GskRenderNode *child,
char *message);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_debug_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_debug_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const char * gsk_debug_node_get_message (GskRenderNode *node);
const char * gsk_debug_node_get_message (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_color_node_get_type (void) G_GNUC_CONST;
@ -207,7 +207,7 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_color_node_new (const GdkRGBA *rgba,
const graphene_rect_t *bounds);
GDK_AVAILABLE_IN_ALL
const GdkRGBA * gsk_color_node_get_color (GskRenderNode *node);
const GdkRGBA * gsk_color_node_get_color (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_texture_node_get_type (void) G_GNUC_CONST;
@ -215,7 +215,7 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_texture_node_new (GdkTexture *texture,
const graphene_rect_t *bounds);
GDK_AVAILABLE_IN_ALL
GdkTexture * gsk_texture_node_get_texture (GskRenderNode *node);
GdkTexture * gsk_texture_node_get_texture (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_linear_gradient_node_get_type (void) G_GNUC_CONST;
@ -226,14 +226,14 @@ GskRenderNode * gsk_linear_gradient_node_new (const graph
const GskColorStop *color_stops,
gsize n_color_stops);
GDK_AVAILABLE_IN_ALL
const graphene_point_t * gsk_linear_gradient_node_get_start (GskRenderNode *node);
const graphene_point_t * gsk_linear_gradient_node_get_start (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const graphene_point_t * gsk_linear_gradient_node_get_end (GskRenderNode *node);
const graphene_point_t * gsk_linear_gradient_node_get_end (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
gsize gsk_linear_gradient_node_get_n_color_stops (GskRenderNode *node);
gsize gsk_linear_gradient_node_get_n_color_stops (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GskColorStop * gsk_linear_gradient_node_get_color_stops (GskRenderNode *node,
gsize *n_stops);
const GskColorStop * gsk_linear_gradient_node_get_color_stops (const GskRenderNode *node,
gsize *n_stops) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_repeating_linear_gradient_node_get_type (void) G_GNUC_CONST;
@ -253,16 +253,16 @@ GskRenderNode * gsk_conic_gradient_node_new (const graph
const GskColorStop *color_stops,
gsize n_color_stops);
GDK_AVAILABLE_IN_ALL
const graphene_point_t * gsk_conic_gradient_node_get_center (GskRenderNode *node);
const graphene_point_t * gsk_conic_gradient_node_get_center (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_conic_gradient_node_get_rotation (GskRenderNode *node);
float gsk_conic_gradient_node_get_rotation (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_conic_gradient_node_get_angle (GskRenderNode *node);
float gsk_conic_gradient_node_get_angle (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
gsize gsk_conic_gradient_node_get_n_color_stops (GskRenderNode *node);
gsize gsk_conic_gradient_node_get_n_color_stops (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GskColorStop * gsk_conic_gradient_node_get_color_stops (GskRenderNode *node,
gsize *n_stops);
const GskColorStop * gsk_conic_gradient_node_get_color_stops (const GskRenderNode *node,
gsize *n_stops) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_radial_gradient_node_get_type (void) G_GNUC_CONST;
@ -276,20 +276,20 @@ GskRenderNode * gsk_radial_gradient_node_new (const graphene_rect_t
const GskColorStop *color_stops,
gsize n_color_stops);
GDK_AVAILABLE_IN_ALL
gsize gsk_radial_gradient_node_get_n_color_stops (GskRenderNode *node);
gsize gsk_radial_gradient_node_get_n_color_stops (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GskColorStop * gsk_radial_gradient_node_get_color_stops (GskRenderNode *node,
gsize *n_stops);
const GskColorStop * gsk_radial_gradient_node_get_color_stops (const GskRenderNode *node,
gsize *n_stops) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const graphene_point_t *gsk_radial_gradient_node_get_center (GskRenderNode *node);
const graphene_point_t *gsk_radial_gradient_node_get_center (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_radial_gradient_node_get_hradius (GskRenderNode *node);
float gsk_radial_gradient_node_get_hradius (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_radial_gradient_node_get_vradius (GskRenderNode *node);
float gsk_radial_gradient_node_get_vradius (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_radial_gradient_node_get_start (GskRenderNode *node);
float gsk_radial_gradient_node_get_start (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_radial_gradient_node_get_end (GskRenderNode *node);
float gsk_radial_gradient_node_get_end (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_repeating_radial_gradient_node_get_type (void) G_GNUC_CONST;
@ -310,11 +310,11 @@ GskRenderNode * gsk_border_node_new (const GskRounde
const float border_width[4],
const GdkRGBA border_color[4]);
GDK_AVAILABLE_IN_ALL
const GskRoundedRect * gsk_border_node_get_outline (GskRenderNode *node);
const GskRoundedRect * gsk_border_node_get_outline (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const float * gsk_border_node_get_widths (GskRenderNode *node);
const float * gsk_border_node_get_widths (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GdkRGBA * gsk_border_node_get_colors (GskRenderNode *node);
const GdkRGBA * gsk_border_node_get_colors (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_inset_shadow_node_get_type (void) G_GNUC_CONST;
@ -326,17 +326,17 @@ GskRenderNode * gsk_inset_shadow_node_new (const GskRounde
float spread,
float blur_radius);
GDK_AVAILABLE_IN_ALL
const GskRoundedRect * gsk_inset_shadow_node_get_outline (GskRenderNode *node);
const GskRoundedRect * gsk_inset_shadow_node_get_outline (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GdkRGBA * gsk_inset_shadow_node_get_color (GskRenderNode *node);
const GdkRGBA * gsk_inset_shadow_node_get_color (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_inset_shadow_node_get_dx (GskRenderNode *node);
float gsk_inset_shadow_node_get_dx (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_inset_shadow_node_get_dy (GskRenderNode *node);
float gsk_inset_shadow_node_get_dy (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_inset_shadow_node_get_spread (GskRenderNode *node);
float gsk_inset_shadow_node_get_spread (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_inset_shadow_node_get_blur_radius (GskRenderNode *node);
float gsk_inset_shadow_node_get_blur_radius (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_outset_shadow_node_get_type (void) G_GNUC_CONST;
@ -348,17 +348,17 @@ GskRenderNode * gsk_outset_shadow_node_new (const GskRounde
float spread,
float blur_radius);
GDK_AVAILABLE_IN_ALL
const GskRoundedRect * gsk_outset_shadow_node_get_outline (GskRenderNode *node);
const GskRoundedRect * gsk_outset_shadow_node_get_outline (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GdkRGBA * gsk_outset_shadow_node_get_color (GskRenderNode *node);
const GdkRGBA * gsk_outset_shadow_node_get_color (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_outset_shadow_node_get_dx (GskRenderNode *node);
float gsk_outset_shadow_node_get_dx (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_outset_shadow_node_get_dy (GskRenderNode *node);
float gsk_outset_shadow_node_get_dy (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_outset_shadow_node_get_spread (GskRenderNode *node);
float gsk_outset_shadow_node_get_spread (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_outset_shadow_node_get_blur_radius (GskRenderNode *node);
float gsk_outset_shadow_node_get_blur_radius (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_cairo_node_get_type (void) G_GNUC_CONST;
@ -375,10 +375,10 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_container_node_new (GskRenderNode **children,
guint n_children);
GDK_AVAILABLE_IN_ALL
guint gsk_container_node_get_n_children (GskRenderNode *node);
guint gsk_container_node_get_n_children (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_container_node_get_child (GskRenderNode *node,
guint idx);
GskRenderNode * gsk_container_node_get_child (const GskRenderNode *node,
guint idx) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_transform_node_get_type (void) G_GNUC_CONST;
@ -386,9 +386,9 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_transform_node_new (GskRenderNode *child,
GskTransform *transform);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_transform_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_transform_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GskTransform * gsk_transform_node_get_transform (GskRenderNode *node);
GskTransform * gsk_transform_node_get_transform (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_opacity_node_get_type (void) G_GNUC_CONST;
@ -396,9 +396,9 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_opacity_node_new (GskRenderNode *child,
float opacity);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_opacity_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_opacity_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_opacity_node_get_opacity (GskRenderNode *node);
float gsk_opacity_node_get_opacity (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_color_matrix_node_get_type (void) G_GNUC_CONST;
@ -407,12 +407,12 @@ GskRenderNode * gsk_color_matrix_node_new (GskRenderNode
const graphene_matrix_t *color_matrix,
const graphene_vec4_t *color_offset);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_color_matrix_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_color_matrix_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const graphene_matrix_t *
gsk_color_matrix_node_get_color_matrix (GskRenderNode *node);
gsk_color_matrix_node_get_color_matrix (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const graphene_vec4_t * gsk_color_matrix_node_get_color_offset (GskRenderNode *node);
const graphene_vec4_t * gsk_color_matrix_node_get_color_offset (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_repeat_node_get_type (void) G_GNUC_CONST;
@ -421,9 +421,9 @@ GskRenderNode * gsk_repeat_node_new (const graphene_
GskRenderNode *child,
const graphene_rect_t *child_bounds);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_repeat_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_repeat_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const graphene_rect_t * gsk_repeat_node_get_child_bounds (GskRenderNode *node);
const graphene_rect_t * gsk_repeat_node_get_child_bounds (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_clip_node_get_type (void) G_GNUC_CONST;
@ -431,9 +431,9 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_clip_node_new (GskRenderNode *child,
const graphene_rect_t *clip);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_clip_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_clip_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const graphene_rect_t * gsk_clip_node_get_clip (GskRenderNode *node);
const graphene_rect_t * gsk_clip_node_get_clip (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_rounded_clip_node_get_type (void) G_GNUC_CONST;
@ -441,9 +441,9 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_rounded_clip_node_new (GskRenderNode *child,
const GskRoundedRect *clip);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_rounded_clip_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_rounded_clip_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GskRoundedRect * gsk_rounded_clip_node_get_clip (GskRenderNode *node);
const GskRoundedRect * gsk_rounded_clip_node_get_clip (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_shadow_node_get_type (void) G_GNUC_CONST;
@ -452,12 +452,12 @@ GskRenderNode * gsk_shadow_node_new (GskRenderNode
const GskShadow *shadows,
gsize n_shadows);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_shadow_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_shadow_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GskShadow * gsk_shadow_node_get_shadow (GskRenderNode *node,
gsize i);
const GskShadow * gsk_shadow_node_get_shadow (const GskRenderNode *node,
gsize i) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
gsize gsk_shadow_node_get_n_shadows (GskRenderNode *node);
gsize gsk_shadow_node_get_n_shadows (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_blend_node_get_type (void) G_GNUC_CONST;
@ -466,11 +466,11 @@ GskRenderNode * gsk_blend_node_new (GskRenderNode
GskRenderNode *top,
GskBlendMode blend_mode);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_blend_node_get_bottom_child (GskRenderNode *node);
GskRenderNode * gsk_blend_node_get_bottom_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_blend_node_get_top_child (GskRenderNode *node);
GskRenderNode * gsk_blend_node_get_top_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GskBlendMode gsk_blend_node_get_blend_mode (GskRenderNode *node);
GskBlendMode gsk_blend_node_get_blend_mode (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_cross_fade_node_get_type (void) G_GNUC_CONST;
@ -479,11 +479,11 @@ GskRenderNode * gsk_cross_fade_node_new (GskRenderNode
GskRenderNode *end,
float progress);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_cross_fade_node_get_start_child (GskRenderNode *node);
GskRenderNode * gsk_cross_fade_node_get_start_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_cross_fade_node_get_end_child (GskRenderNode *node);
GskRenderNode * gsk_cross_fade_node_get_end_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_cross_fade_node_get_progress (GskRenderNode *node);
float gsk_cross_fade_node_get_progress (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_text_node_get_type (void) G_GNUC_CONST;
@ -493,17 +493,17 @@ GskRenderNode * gsk_text_node_new (PangoFont
const GdkRGBA *color,
const graphene_point_t *offset);
GDK_AVAILABLE_IN_ALL
PangoFont * gsk_text_node_get_font (GskRenderNode *node);
gboolean gsk_text_node_has_color_glyphs (GskRenderNode *node);
PangoFont * gsk_text_node_get_font (const GskRenderNode *node) G_GNUC_PURE;
gboolean gsk_text_node_has_color_glyphs (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
guint gsk_text_node_get_num_glyphs (GskRenderNode *node);
guint gsk_text_node_get_num_glyphs (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const PangoGlyphInfo *gsk_text_node_get_glyphs (GskRenderNode *node,
guint *n_glyphs);
const PangoGlyphInfo *gsk_text_node_get_glyphs (const GskRenderNode *node,
guint *n_glyphs) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const GdkRGBA * gsk_text_node_get_color (GskRenderNode *node);
const GdkRGBA * gsk_text_node_get_color (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
const graphene_point_t *gsk_text_node_get_offset (GskRenderNode *node);
const graphene_point_t *gsk_text_node_get_offset (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_blur_node_get_type (void) G_GNUC_CONST;
@ -511,9 +511,9 @@ GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_blur_node_new (GskRenderNode *child,
float radius);
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_blur_node_get_child (GskRenderNode *node);
GskRenderNode * gsk_blur_node_get_child (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_blur_node_get_radius (GskRenderNode *node);
float gsk_blur_node_get_radius (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GType gsk_gl_shader_node_get_type (void) G_GNUC_CONST;
@ -524,14 +524,14 @@ GskRenderNode * gsk_gl_shader_node_new (GskGLShader
GskRenderNode **children,
guint n_children);
GDK_AVAILABLE_IN_ALL
guint gsk_gl_shader_node_get_n_children (GskRenderNode *node);
guint gsk_gl_shader_node_get_n_children (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GskRenderNode * gsk_gl_shader_node_get_child (GskRenderNode *node,
guint idx);
GskRenderNode * gsk_gl_shader_node_get_child (const GskRenderNode *node,
guint idx) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GBytes * gsk_gl_shader_node_get_args (GskRenderNode *node);
GBytes * gsk_gl_shader_node_get_args (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GskGLShader * gsk_gl_shader_node_get_shader (GskRenderNode *node);
GskGLShader * gsk_gl_shader_node_get_shader (const GskRenderNode *node) G_GNUC_PURE;
G_END_DECLS

View File

@ -99,7 +99,7 @@ gsk_color_node_diff (GskRenderNode *node1,
* Returns: (transfer none): the color of the node
*/
const GdkRGBA *
gsk_color_node_get_color (GskRenderNode *node)
gsk_color_node_get_color (const GskRenderNode *node)
{
GskColorNode *self = (GskColorNode *) node;
@ -346,9 +346,9 @@ gsk_repeating_linear_gradient_node_new (const graphene_rect_t *bounds,
* Returns: (transfer none): the initial point
*/
const graphene_point_t *
gsk_linear_gradient_node_get_start (GskRenderNode *node)
gsk_linear_gradient_node_get_start (const GskRenderNode *node)
{
GskLinearGradientNode *self = (GskLinearGradientNode *) node;
const GskLinearGradientNode *self = (const GskLinearGradientNode *) node;
return &self->start;
}
@ -362,9 +362,9 @@ gsk_linear_gradient_node_get_start (GskRenderNode *node)
* Returns: (transfer none): the final point
*/
const graphene_point_t *
gsk_linear_gradient_node_get_end (GskRenderNode *node)
gsk_linear_gradient_node_get_end (const GskRenderNode *node)
{
GskLinearGradientNode *self = (GskLinearGradientNode *) node;
const GskLinearGradientNode *self = (const GskLinearGradientNode *) node;
return &self->end;
}
@ -378,9 +378,9 @@ gsk_linear_gradient_node_get_end (GskRenderNode *node)
* Returns: the number of color stops
*/
gsize
gsk_linear_gradient_node_get_n_color_stops (GskRenderNode *node)
gsk_linear_gradient_node_get_n_color_stops (const GskRenderNode *node)
{
GskLinearGradientNode *self = (GskLinearGradientNode *) node;
const GskLinearGradientNode *self = (const GskLinearGradientNode *) node;
return self->n_stops;
}
@ -395,10 +395,10 @@ gsk_linear_gradient_node_get_n_color_stops (GskRenderNode *node)
* Returns: (array length=n_stops): the color stops in the gradient
*/
const GskColorStop *
gsk_linear_gradient_node_get_color_stops (GskRenderNode *node,
gsize *n_stops)
gsk_linear_gradient_node_get_color_stops (const GskRenderNode *node,
gsize *n_stops)
{
GskLinearGradientNode *self = (GskLinearGradientNode *) node;
const GskLinearGradientNode *self = (const GskLinearGradientNode *) node;
if (n_stops != NULL)
*n_stops = self->n_stops;
@ -660,9 +660,9 @@ gsk_repeating_radial_gradient_node_new (const graphene_rect_t *bounds,
* Returns: the number of color stops
*/
gsize
gsk_radial_gradient_node_get_n_color_stops (GskRenderNode *node)
gsk_radial_gradient_node_get_n_color_stops (const GskRenderNode *node)
{
GskRadialGradientNode *self = (GskRadialGradientNode *) node;
const GskRadialGradientNode *self = (const GskRadialGradientNode *) node;
return self->n_stops;
}
@ -677,10 +677,10 @@ gsk_radial_gradient_node_get_n_color_stops (GskRenderNode *node)
* Returns: (array length=n_stops): the color stops in the gradient
*/
const GskColorStop *
gsk_radial_gradient_node_get_color_stops (GskRenderNode *node,
gsize *n_stops)
gsk_radial_gradient_node_get_color_stops (const GskRenderNode *node,
gsize *n_stops)
{
GskRadialGradientNode *self = (GskRadialGradientNode *) node;
const GskRadialGradientNode *self = (const GskRadialGradientNode *) node;
if (n_stops != NULL)
*n_stops = self->n_stops;
@ -697,9 +697,9 @@ gsk_radial_gradient_node_get_color_stops (GskRenderNode *node,
* Returns: the center point for the gradient
*/
const graphene_point_t *
gsk_radial_gradient_node_get_center (GskRenderNode *node)
gsk_radial_gradient_node_get_center (const GskRenderNode *node)
{
GskRadialGradientNode *self = (GskRadialGradientNode *) node;
const GskRadialGradientNode *self = (const GskRadialGradientNode *) node;
return &self->center;
}
@ -713,9 +713,9 @@ gsk_radial_gradient_node_get_center (GskRenderNode *node)
* Returns: the horizontal radius for the gradient
*/
float
gsk_radial_gradient_node_get_hradius (GskRenderNode *node)
gsk_radial_gradient_node_get_hradius (const GskRenderNode *node)
{
GskRadialGradientNode *self = (GskRadialGradientNode *) node;
const GskRadialGradientNode *self = (const GskRadialGradientNode *) node;
return self->hradius;
}
@ -729,9 +729,9 @@ gsk_radial_gradient_node_get_hradius (GskRenderNode *node)
* Returns: the vertical radius for the gradient
*/
float
gsk_radial_gradient_node_get_vradius (GskRenderNode *node)
gsk_radial_gradient_node_get_vradius (const GskRenderNode *node)
{
GskRadialGradientNode *self = (GskRadialGradientNode *) node;
const GskRadialGradientNode *self = (const GskRadialGradientNode *) node;
return self->vradius;
}
@ -745,9 +745,9 @@ gsk_radial_gradient_node_get_vradius (GskRenderNode *node)
* Returns: the start value for the gradient
*/
float
gsk_radial_gradient_node_get_start (GskRenderNode *node)
gsk_radial_gradient_node_get_start (const GskRenderNode *node)
{
GskRadialGradientNode *self = (GskRadialGradientNode *) node;
const GskRadialGradientNode *self = (const GskRadialGradientNode *) node;
return self->start;
}
@ -761,9 +761,9 @@ gsk_radial_gradient_node_get_start (GskRenderNode *node)
* Returns: the end value for the gradient
*/
float
gsk_radial_gradient_node_get_end (GskRenderNode *node)
gsk_radial_gradient_node_get_end (const GskRenderNode *node)
{
GskRadialGradientNode *self = (GskRadialGradientNode *) node;
const GskRadialGradientNode *self = (const GskRadialGradientNode *) node;
return self->end;
}
@ -832,7 +832,7 @@ project (double angle,
}
static void
gsk_conic_gradient_node_add_patch (cairo_pattern_t *pattern,
gsk_conic_gradient_node_add_patch (cairo_pattern_t *pattern,
float radius,
float start_angle,
const GdkRGBA *start_color,
@ -926,7 +926,7 @@ gsk_conic_gradient_node_draw (GskRenderNode *node,
&stop2->color,
(end_angle - offset1) / (offset2 - offset1));
gsk_conic_gradient_node_add_patch (pattern,
gsk_conic_gradient_node_add_patch (pattern,
radius,
DEG_TO_RAD (start_angle),
&start_color,
@ -1042,9 +1042,9 @@ gsk_conic_gradient_node_new (const graphene_rect_t *bounds,
* Returns: the number of color stops
*/
gsize
gsk_conic_gradient_node_get_n_color_stops (GskRenderNode *node)
gsk_conic_gradient_node_get_n_color_stops (const GskRenderNode *node)
{
GskConicGradientNode *self = (GskConicGradientNode *) node;
const GskConicGradientNode *self = (const GskConicGradientNode *) node;
return self->n_stops;
}
@ -1059,10 +1059,10 @@ gsk_conic_gradient_node_get_n_color_stops (GskRenderNode *node)
* Returns: (array length=n_stops): the color stops in the gradient
*/
const GskColorStop *
gsk_conic_gradient_node_get_color_stops (GskRenderNode *node,
gsize *n_stops)
gsk_conic_gradient_node_get_color_stops (const GskRenderNode *node,
gsize *n_stops)
{
GskConicGradientNode *self = (GskConicGradientNode *) node;
const GskConicGradientNode *self = (const GskConicGradientNode *) node;
if (n_stops != NULL)
*n_stops = self->n_stops;
@ -1079,9 +1079,9 @@ gsk_conic_gradient_node_get_color_stops (GskRenderNode *node,
* Returns: the center point for the gradient
*/
const graphene_point_t *
gsk_conic_gradient_node_get_center (GskRenderNode *node)
gsk_conic_gradient_node_get_center (const GskRenderNode *node)
{
GskConicGradientNode *self = (GskConicGradientNode *) node;
const GskConicGradientNode *self = (const GskConicGradientNode *) node;
return &self->center;
}
@ -1095,9 +1095,9 @@ gsk_conic_gradient_node_get_center (GskRenderNode *node)
* Returns: the rotation for the gradient
*/
float
gsk_conic_gradient_node_get_rotation (GskRenderNode *node)
gsk_conic_gradient_node_get_rotation (const GskRenderNode *node)
{
GskConicGradientNode *self = (GskConicGradientNode *) node;
const GskConicGradientNode *self = (const GskConicGradientNode *) node;
return self->rotation;
}
@ -1115,9 +1115,9 @@ gsk_conic_gradient_node_get_rotation (GskRenderNode *node)
* Returns: the angle for the gradient
*/
float
gsk_conic_gradient_node_get_angle (GskRenderNode *node)
gsk_conic_gradient_node_get_angle (const GskRenderNode *node)
{
GskConicGradientNode *self = (GskConicGradientNode *) node;
const GskConicGradientNode *self = (const GskConicGradientNode *) node;
return self->angle;
}
@ -1320,9 +1320,9 @@ gsk_border_node_diff (GskRenderNode *node1,
* Returns: the outline of the border
*/
const GskRoundedRect *
gsk_border_node_get_outline (GskRenderNode *node)
gsk_border_node_get_outline (const GskRenderNode *node)
{
GskBorderNode *self = (GskBorderNode *) node;
const GskBorderNode *self = (const GskBorderNode *) node;
return &self->outline;
}
@ -1338,9 +1338,9 @@ gsk_border_node_get_outline (GskRenderNode *node)
* respectively
*/
const float *
gsk_border_node_get_widths (GskRenderNode *node)
gsk_border_node_get_widths (const GskRenderNode *node)
{
GskBorderNode *self = (GskBorderNode *) node;
const GskBorderNode *self = (const GskBorderNode *) node;
return self->border_width;
}
@ -1355,9 +1355,9 @@ gsk_border_node_get_widths (GskRenderNode *node)
* for the top, right, bottom and left color of the border
*/
const GdkRGBA *
gsk_border_node_get_colors (GskRenderNode *node)
gsk_border_node_get_colors (const GskRenderNode *node)
{
GskBorderNode *self = (GskBorderNode *) node;
const GskBorderNode *self = (const GskBorderNode *) node;
return self->border_color;
}
@ -1413,9 +1413,9 @@ gsk_border_node_new (const GskRoundedRect *outline,
/* Private */
bool
gsk_border_node_get_uniform (GskRenderNode *self)
gsk_border_node_get_uniform (const GskRenderNode *self)
{
return ((GskBorderNode *)self)->uniform;
return ((const GskBorderNode *)self)->uniform;
}
/*** GSK_TEXTURE_NODE ***/
@ -1496,11 +1496,9 @@ gsk_texture_node_diff (GskRenderNode *node1,
* Returns: (transfer none): the #GdkTexture
*/
GdkTexture *
gsk_texture_node_get_texture (GskRenderNode *node)
gsk_texture_node_get_texture (const GskRenderNode *node)
{
GskTextureNode *self = (GskTextureNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXTURE_NODE), 0);
const GskTextureNode *self = (const GskTextureNode *) node;
return self->texture;
}
@ -1999,11 +1997,9 @@ gsk_inset_shadow_node_new (const GskRoundedRect *outline,
* Returns: (transfer none): a rounded rectangle
*/
const GskRoundedRect *
gsk_inset_shadow_node_get_outline (GskRenderNode *node)
gsk_inset_shadow_node_get_outline (const GskRenderNode *node)
{
GskInsetShadowNode *self = (GskInsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_INSET_SHADOW_NODE), NULL);
const GskInsetShadowNode *self = (const GskInsetShadowNode *) node;
return &self->outline;
}
@ -2017,11 +2013,9 @@ gsk_inset_shadow_node_get_outline (GskRenderNode *node)
* Returns: (transfer none): the color of the shadow
*/
const GdkRGBA *
gsk_inset_shadow_node_get_color (GskRenderNode *node)
gsk_inset_shadow_node_get_color (const GskRenderNode *node)
{
GskInsetShadowNode *self = (GskInsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_INSET_SHADOW_NODE), NULL);
const GskInsetShadowNode *self = (const GskInsetShadowNode *) node;
return &self->color;
}
@ -2035,11 +2029,9 @@ gsk_inset_shadow_node_get_color (GskRenderNode *node)
* Returns: an offset, in pixels
*/
float
gsk_inset_shadow_node_get_dx (GskRenderNode *node)
gsk_inset_shadow_node_get_dx (const GskRenderNode *node)
{
GskInsetShadowNode *self = (GskInsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_INSET_SHADOW_NODE), 0.0f);
const GskInsetShadowNode *self = (const GskInsetShadowNode *) node;
return self->dx;
}
@ -2053,11 +2045,9 @@ gsk_inset_shadow_node_get_dx (GskRenderNode *node)
* Returns: an offset, in pixels
*/
float
gsk_inset_shadow_node_get_dy (GskRenderNode *node)
gsk_inset_shadow_node_get_dy (const GskRenderNode *node)
{
GskInsetShadowNode *self = (GskInsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_INSET_SHADOW_NODE), 0.0f);
const GskInsetShadowNode *self = (const GskInsetShadowNode *) node;
return self->dy;
}
@ -2071,11 +2061,9 @@ gsk_inset_shadow_node_get_dy (GskRenderNode *node)
* Returns: the size of the shadow, in pixels
*/
float
gsk_inset_shadow_node_get_spread (GskRenderNode *node)
gsk_inset_shadow_node_get_spread (const GskRenderNode *node)
{
GskInsetShadowNode *self = (GskInsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_INSET_SHADOW_NODE), 0.0f);
const GskInsetShadowNode *self = (const GskInsetShadowNode *) node;
return self->spread;
}
@ -2089,11 +2077,9 @@ gsk_inset_shadow_node_get_spread (GskRenderNode *node)
* Returns: the blur radius, in pixels
*/
float
gsk_inset_shadow_node_get_blur_radius (GskRenderNode *node)
gsk_inset_shadow_node_get_blur_radius (const GskRenderNode *node)
{
GskInsetShadowNode *self = (GskInsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_INSET_SHADOW_NODE), 0.0f);
const GskInsetShadowNode *self = (const GskInsetShadowNode *) node;
return self->blur_radius;
}
@ -2313,11 +2299,9 @@ gsk_outset_shadow_node_new (const GskRoundedRect *outline,
* Returns: (transfer none): a rounded rectangle
*/
const GskRoundedRect *
gsk_outset_shadow_node_get_outline (GskRenderNode *node)
gsk_outset_shadow_node_get_outline (const GskRenderNode *node)
{
GskOutsetShadowNode *self = (GskOutsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_OUTSET_SHADOW_NODE), NULL);
const GskOutsetShadowNode *self = (const GskOutsetShadowNode *) node;
return &self->outline;
}
@ -2331,11 +2315,9 @@ gsk_outset_shadow_node_get_outline (GskRenderNode *node)
* Returns: (transfer none): a color
*/
const GdkRGBA *
gsk_outset_shadow_node_get_color (GskRenderNode *node)
gsk_outset_shadow_node_get_color (const GskRenderNode *node)
{
GskOutsetShadowNode *self = (GskOutsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_OUTSET_SHADOW_NODE), NULL);
const GskOutsetShadowNode *self = (const GskOutsetShadowNode *) node;
return &self->color;
}
@ -2349,11 +2331,9 @@ gsk_outset_shadow_node_get_color (GskRenderNode *node)
* Returns: an offset, in pixels
*/
float
gsk_outset_shadow_node_get_dx (GskRenderNode *node)
gsk_outset_shadow_node_get_dx (const GskRenderNode *node)
{
GskOutsetShadowNode *self = (GskOutsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_OUTSET_SHADOW_NODE), 0.0f);
const GskOutsetShadowNode *self = (const GskOutsetShadowNode *) node;
return self->dx;
}
@ -2367,11 +2347,9 @@ gsk_outset_shadow_node_get_dx (GskRenderNode *node)
* Returns: an offset, in pixels
*/
float
gsk_outset_shadow_node_get_dy (GskRenderNode *node)
gsk_outset_shadow_node_get_dy (const GskRenderNode *node)
{
GskOutsetShadowNode *self = (GskOutsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_OUTSET_SHADOW_NODE), 0.0f);
const GskOutsetShadowNode *self = (const GskOutsetShadowNode *) node;
return self->dy;
}
@ -2385,11 +2363,9 @@ gsk_outset_shadow_node_get_dy (GskRenderNode *node)
* Returns: the size of the shadow, in pixels
*/
float
gsk_outset_shadow_node_get_spread (GskRenderNode *node)
gsk_outset_shadow_node_get_spread (const GskRenderNode *node)
{
GskOutsetShadowNode *self = (GskOutsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_OUTSET_SHADOW_NODE), 0.0f);
const GskOutsetShadowNode *self = (const GskOutsetShadowNode *) node;
return self->spread;
}
@ -2403,11 +2379,9 @@ gsk_outset_shadow_node_get_spread (GskRenderNode *node)
* Returns: the blur radius, in pixels
*/
float
gsk_outset_shadow_node_get_blur_radius (GskRenderNode *node)
gsk_outset_shadow_node_get_blur_radius (const GskRenderNode *node)
{
GskOutsetShadowNode *self = (GskOutsetShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_OUTSET_SHADOW_NODE), 0.0f);
const GskOutsetShadowNode *self = (const GskOutsetShadowNode *) node;
return self->blur_radius;
}
@ -2710,11 +2684,9 @@ gsk_container_node_new (GskRenderNode **children,
* Returns: the number of children of the #GskRenderNode
*/
guint
gsk_container_node_get_n_children (GskRenderNode *node)
gsk_container_node_get_n_children (const GskRenderNode *node)
{
GskContainerNode *self = (GskContainerNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CONTAINER_NODE), 0);
const GskContainerNode *self = (const GskContainerNode *) node;
return self->n_children;
}
@ -2729,13 +2701,13 @@ gsk_container_node_get_n_children (GskRenderNode *node)
* Returns: (transfer none): the @idx'th child of @container
*/
GskRenderNode *
gsk_container_node_get_child (GskRenderNode *node,
guint idx)
gsk_container_node_get_child (const GskRenderNode *node,
guint idx)
{
GskContainerNode *self = (GskContainerNode *) node;
const GskContainerNode *self = (const GskContainerNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CONTAINER_NODE), NULL);
g_return_val_if_fail (idx < self->n_children, 0);
g_return_val_if_fail (idx < self->n_children, NULL);
return self->children[idx];
}
@ -2921,11 +2893,9 @@ gsk_transform_node_new (GskRenderNode *child,
* Returns: (transfer none): The child that is getting transformed
*/
GskRenderNode *
gsk_transform_node_get_child (GskRenderNode *node)
gsk_transform_node_get_child (const GskRenderNode *node)
{
GskTransformNode *self = (GskTransformNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TRANSFORM_NODE), NULL);
const GskTransformNode *self = (const GskTransformNode *) node;
return self->child;
}
@ -2939,11 +2909,9 @@ gsk_transform_node_get_child (GskRenderNode *node)
* Returns: (transfer none): a #GskTransform
*/
GskTransform *
gsk_transform_node_get_transform (GskRenderNode *node)
gsk_transform_node_get_transform (const GskRenderNode *node)
{
GskTransformNode *self = (GskTransformNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TRANSFORM_NODE), NULL);
const GskTransformNode *self = (const GskTransformNode *) node;
return self->transform;
}
@ -3049,11 +3017,9 @@ gsk_opacity_node_new (GskRenderNode *child,
* Returns: (transfer none): The child that is getting opacityed
*/
GskRenderNode *
gsk_opacity_node_get_child (GskRenderNode *node)
gsk_opacity_node_get_child (const GskRenderNode *node)
{
GskOpacityNode *self = (GskOpacityNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_OPACITY_NODE), NULL);
const GskOpacityNode *self = (const GskOpacityNode *) node;
return self->child;
}
@ -3067,11 +3033,9 @@ gsk_opacity_node_get_child (GskRenderNode *node)
* Returns: the opacity factor
*/
float
gsk_opacity_node_get_opacity (GskRenderNode *node)
gsk_opacity_node_get_opacity (const GskRenderNode *node)
{
GskOpacityNode *self = (GskOpacityNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_OPACITY_NODE), 1.0);
const GskOpacityNode *self = (const GskOpacityNode *) node;
return self->opacity;
}
@ -3257,11 +3221,9 @@ gsk_color_matrix_node_new (GskRenderNode *child,
* Returns: (transfer none): The child that is getting its colors modified
**/
GskRenderNode *
gsk_color_matrix_node_get_child (GskRenderNode *node)
gsk_color_matrix_node_get_child (const GskRenderNode *node)
{
GskColorMatrixNode *self = (GskColorMatrixNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_COLOR_MATRIX_NODE), NULL);
const GskColorMatrixNode *self = (const GskColorMatrixNode *) node;
return self->child;
}
@ -3275,11 +3237,9 @@ gsk_color_matrix_node_get_child (GskRenderNode *node)
* Returns: a 4x4 color matrix
*/
const graphene_matrix_t *
gsk_color_matrix_node_get_color_matrix (GskRenderNode *node)
gsk_color_matrix_node_get_color_matrix (const GskRenderNode *node)
{
GskColorMatrixNode *self = (GskColorMatrixNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_COLOR_MATRIX_NODE), NULL);
const GskColorMatrixNode *self = (const GskColorMatrixNode *) node;
return &self->color_matrix;
}
@ -3293,11 +3253,9 @@ gsk_color_matrix_node_get_color_matrix (GskRenderNode *node)
* Returns: a color vector
*/
const graphene_vec4_t *
gsk_color_matrix_node_get_color_offset (GskRenderNode *node)
gsk_color_matrix_node_get_color_offset (const GskRenderNode *node)
{
GskColorMatrixNode *self = (GskColorMatrixNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_COLOR_MATRIX_NODE), NULL);
const GskColorMatrixNode *self = (const GskColorMatrixNode *) node;
return &self->color_offset;
}
@ -3412,11 +3370,9 @@ gsk_repeat_node_new (const graphene_rect_t *bounds,
* Returns: (transfer none): a #GskRenderNode
*/
GskRenderNode *
gsk_repeat_node_get_child (GskRenderNode *node)
gsk_repeat_node_get_child (const GskRenderNode *node)
{
GskRepeatNode *self = (GskRepeatNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_REPEAT_NODE), NULL);
const GskRepeatNode *self = (const GskRepeatNode *) node;
return self->child;
}
@ -3430,11 +3386,9 @@ gsk_repeat_node_get_child (GskRenderNode *node)
* Returns: (transfer none): a bounding rectangle
*/
const graphene_rect_t *
gsk_repeat_node_get_child_bounds (GskRenderNode *node)
gsk_repeat_node_get_child_bounds (const GskRenderNode *node)
{
GskRepeatNode *self = (GskRepeatNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_REPEAT_NODE), NULL);
const GskRepeatNode *self = (const GskRepeatNode *) node;
return &self->child_bounds;
}
@ -3547,11 +3501,9 @@ gsk_clip_node_new (GskRenderNode *child,
* Returns: (transfer none): The child that is getting clipped
**/
GskRenderNode *
gsk_clip_node_get_child (GskRenderNode *node)
gsk_clip_node_get_child (const GskRenderNode *node)
{
GskClipNode *self = (GskClipNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CLIP_NODE), NULL);
const GskClipNode *self = (const GskClipNode *) node;
return self->child;
}
@ -3565,11 +3517,9 @@ gsk_clip_node_get_child (GskRenderNode *node)
* Returns: a clip rectangle
*/
const graphene_rect_t *
gsk_clip_node_get_clip (GskRenderNode *node)
gsk_clip_node_get_clip (const GskRenderNode *node)
{
GskClipNode *self = (GskClipNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CLIP_NODE), NULL);
const GskClipNode *self = (const GskClipNode *) node;
return &self->clip;
}
@ -3682,11 +3632,9 @@ gsk_rounded_clip_node_new (GskRenderNode *child,
* Returns: (transfer none): The child that is getting clipped
**/
GskRenderNode *
gsk_rounded_clip_node_get_child (GskRenderNode *node)
gsk_rounded_clip_node_get_child (const GskRenderNode *node)
{
GskRoundedClipNode *self = (GskRoundedClipNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_ROUNDED_CLIP_NODE), NULL);
const GskRoundedClipNode *self = (const GskRoundedClipNode *) node;
return self->child;
}
@ -3700,11 +3648,9 @@ gsk_rounded_clip_node_get_child (GskRenderNode *node)
* Returns: (transfer none): a rounded rectangle
*/
const GskRoundedRect *
gsk_rounded_clip_node_get_clip (GskRenderNode *node)
gsk_rounded_clip_node_get_clip (const GskRenderNode *node)
{
GskRoundedClipNode *self = (GskRoundedClipNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_ROUNDED_CLIP_NODE), NULL);
const GskRoundedClipNode *self = (const GskRoundedClipNode *) node;
return &self->clip;
}
@ -3905,11 +3851,9 @@ gsk_shadow_node_new (GskRenderNode *child,
* Returns: (transfer none): the child render node
*/
GskRenderNode *
gsk_shadow_node_get_child (GskRenderNode *node)
gsk_shadow_node_get_child (const GskRenderNode *node)
{
GskShadowNode *self = (GskShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_SHADOW_NODE), NULL);
const GskShadowNode *self = (const GskShadowNode *) node;
return self->child;
}
@ -3924,13 +3868,10 @@ gsk_shadow_node_get_child (GskRenderNode *node)
* Returns: (transfer none): the shadow data
*/
const GskShadow *
gsk_shadow_node_get_shadow (GskRenderNode *node,
gsize i)
gsk_shadow_node_get_shadow (const GskRenderNode *node,
gsize i)
{
GskShadowNode *self = (GskShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_SHADOW_NODE), NULL);
g_return_val_if_fail (i < self->n_shadows, NULL);
const GskShadowNode *self = (const GskShadowNode *) node;
return &self->shadows[i];
}
@ -3944,11 +3885,9 @@ gsk_shadow_node_get_shadow (GskRenderNode *node,
* Returns: the number of shadows.
*/
gsize
gsk_shadow_node_get_n_shadows (GskRenderNode *node)
gsk_shadow_node_get_n_shadows (const GskRenderNode *node)
{
GskShadowNode *self = (GskShadowNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_SHADOW_NODE), 0);
const GskShadowNode *self = (const GskShadowNode *) node;
return self->n_shadows;
}
@ -4105,11 +4044,9 @@ gsk_blend_node_new (GskRenderNode *bottom,
* Returns: (transfer none): the bottom child node
*/
GskRenderNode *
gsk_blend_node_get_bottom_child (GskRenderNode *node)
gsk_blend_node_get_bottom_child (const GskRenderNode *node)
{
GskBlendNode *self = (GskBlendNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_BLEND_NODE), NULL);
const GskBlendNode *self = (const GskBlendNode *) node;
return self->bottom;
}
@ -4123,11 +4060,9 @@ gsk_blend_node_get_bottom_child (GskRenderNode *node)
* Returns: (transfer none): the top child node
*/
GskRenderNode *
gsk_blend_node_get_top_child (GskRenderNode *node)
gsk_blend_node_get_top_child (const GskRenderNode *node)
{
GskBlendNode *self = (GskBlendNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_BLEND_NODE), NULL);
const GskBlendNode *self = (const GskBlendNode *) node;
return self->top;
}
@ -4141,11 +4076,9 @@ gsk_blend_node_get_top_child (GskRenderNode *node)
* Returns: the blend mode
*/
GskBlendMode
gsk_blend_node_get_blend_mode (GskRenderNode *node)
gsk_blend_node_get_blend_mode (const GskRenderNode *node)
{
GskBlendNode *self = (GskBlendNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_BLEND_NODE), GSK_BLEND_MODE_DEFAULT);
const GskBlendNode *self = (const GskBlendNode *) node;
return self->blend_mode;
}
@ -4259,11 +4192,9 @@ gsk_cross_fade_node_new (GskRenderNode *start,
* Returns: (transfer none): a #GskRenderNode
*/
GskRenderNode *
gsk_cross_fade_node_get_start_child (GskRenderNode *node)
gsk_cross_fade_node_get_start_child (const GskRenderNode *node)
{
GskCrossFadeNode *self = (GskCrossFadeNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CROSS_FADE_NODE), NULL);
const GskCrossFadeNode *self = (const GskCrossFadeNode *) node;
return self->start;
}
@ -4277,11 +4208,9 @@ gsk_cross_fade_node_get_start_child (GskRenderNode *node)
* Returns: (transfer none): a #GskRenderNode
*/
GskRenderNode *
gsk_cross_fade_node_get_end_child (GskRenderNode *node)
gsk_cross_fade_node_get_end_child (const GskRenderNode *node)
{
GskCrossFadeNode *self = (GskCrossFadeNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CROSS_FADE_NODE), NULL);
const GskCrossFadeNode *self = (const GskCrossFadeNode *) node;
return self->end;
}
@ -4295,11 +4224,9 @@ gsk_cross_fade_node_get_end_child (GskRenderNode *node)
* Returns: the progress value, between 0 and 1
*/
float
gsk_cross_fade_node_get_progress (GskRenderNode *node)
gsk_cross_fade_node_get_progress (const GskRenderNode *node)
{
GskCrossFadeNode *self = (GskCrossFadeNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CROSS_FADE_NODE), 0.0);
const GskCrossFadeNode *self = (const GskCrossFadeNode *) node;
return self->progress;
}
@ -4470,11 +4397,9 @@ gsk_text_node_new (PangoFont *font,
* Returns: (transfer none): the text color
*/
const GdkRGBA *
gsk_text_node_get_color (GskRenderNode *node)
gsk_text_node_get_color (const GskRenderNode *node)
{
GskTextNode *self = (GskTextNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXT_NODE), NULL);
const GskTextNode *self = (const GskTextNode *) node;
return &self->color;
}
@ -4488,11 +4413,9 @@ gsk_text_node_get_color (GskRenderNode *node)
* Returns: (transfer none): the font
*/
PangoFont *
gsk_text_node_get_font (GskRenderNode *node)
gsk_text_node_get_font (const GskRenderNode *node)
{
GskTextNode *self = (GskTextNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXT_NODE), NULL);
const GskTextNode *self = (const GskTextNode *) node;
return self->font;
}
@ -4506,11 +4429,9 @@ gsk_text_node_get_font (GskRenderNode *node)
* Returns: %TRUE if the text node has color glyphs
*/
gboolean
gsk_text_node_has_color_glyphs (GskRenderNode *node)
gsk_text_node_has_color_glyphs (const GskRenderNode *node)
{
GskTextNode *self = (GskTextNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXT_NODE), FALSE);
const GskTextNode *self = (const GskTextNode *) node;
return self->has_color_glyphs;
}
@ -4524,11 +4445,9 @@ gsk_text_node_has_color_glyphs (GskRenderNode *node)
* Returns: the number of glyphs
*/
guint
gsk_text_node_get_num_glyphs (GskRenderNode *node)
gsk_text_node_get_num_glyphs (const GskRenderNode *node)
{
GskTextNode *self = (GskTextNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXT_NODE), 0);
const GskTextNode *self = (const GskTextNode *) node;
return self->num_glyphs;
}
@ -4543,12 +4462,10 @@ gsk_text_node_get_num_glyphs (GskRenderNode *node)
* Returns: (transfer none) (array length=n_glyphs): the glyph information
*/
const PangoGlyphInfo *
gsk_text_node_get_glyphs (GskRenderNode *node,
guint *n_glyphs)
gsk_text_node_get_glyphs (const GskRenderNode *node,
guint *n_glyphs)
{
GskTextNode *self = (GskTextNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXT_NODE), NULL);
const GskTextNode *self = (const GskTextNode *) node;
if (n_glyphs != NULL)
*n_glyphs = self->num_glyphs;
@ -4565,11 +4482,9 @@ gsk_text_node_get_glyphs (GskRenderNode *node,
* Returns: (transfer none): a point with the horizontal and vertical offsets
*/
const graphene_point_t *
gsk_text_node_get_offset (GskRenderNode *node)
gsk_text_node_get_offset (const GskRenderNode *node)
{
GskTextNode *self = (GskTextNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXT_NODE), NULL);
const GskTextNode *self = (const GskTextNode *) node;
return &self->offset;
}
@ -4864,11 +4779,9 @@ gsk_blur_node_new (GskRenderNode *child,
* Returns: (transfer none): the blurred child node
*/
GskRenderNode *
gsk_blur_node_get_child (GskRenderNode *node)
gsk_blur_node_get_child (const GskRenderNode *node)
{
GskBlurNode *self = (GskBlurNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_BLUR_NODE), NULL);
const GskBlurNode *self = (const GskBlurNode *) node;
return self->child;
}
@ -4882,11 +4795,9 @@ gsk_blur_node_get_child (GskRenderNode *node)
* Returns: the blur radius
*/
float
gsk_blur_node_get_radius (GskRenderNode *node)
gsk_blur_node_get_radius (const GskRenderNode *node)
{
GskBlurNode *self = (GskBlurNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_BLUR_NODE), 0.0);
const GskBlurNode *self = (const GskBlurNode *) node;
return self->radius;
}
@ -4990,11 +4901,9 @@ gsk_debug_node_new (GskRenderNode *child,
* Returns: (transfer none): the child #GskRenderNode
**/
GskRenderNode *
gsk_debug_node_get_child (GskRenderNode *node)
gsk_debug_node_get_child (const GskRenderNode *node)
{
GskDebugNode *self = (GskDebugNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_DEBUG_NODE), NULL);
const GskDebugNode *self = (const GskDebugNode *) node;
return self->child;
}
@ -5008,11 +4917,9 @@ gsk_debug_node_get_child (GskRenderNode *node)
* Returns: (transfer none): The debug message
**/
const char *
gsk_debug_node_get_message (GskRenderNode *node)
gsk_debug_node_get_message (const GskRenderNode *node)
{
GskDebugNode *self = (GskDebugNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_DEBUG_NODE), "You run broken code!");
const GskDebugNode *self = (const GskDebugNode *) node;
return self->message;
}
@ -5159,11 +5066,9 @@ gsk_gl_shader_node_new (GskGLShader *shader,
* Returns: The number of children
*/
guint
gsk_gl_shader_node_get_n_children (GskRenderNode *node)
gsk_gl_shader_node_get_n_children (const GskRenderNode *node)
{
GskGLShaderNode *self = (GskGLShaderNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_GL_SHADER_NODE), 0);
const GskGLShaderNode *self = (const GskGLShaderNode *) node;
return self->n_children;
}
@ -5178,13 +5083,10 @@ gsk_gl_shader_node_get_n_children (GskRenderNode *node)
* Returns: (transfer none): the @idx'th child of @node
*/
GskRenderNode *
gsk_gl_shader_node_get_child (GskRenderNode *node,
guint idx)
gsk_gl_shader_node_get_child (const GskRenderNode *node,
guint idx)
{
GskGLShaderNode *self = (GskGLShaderNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_GL_SHADER_NODE), NULL);
g_return_val_if_fail (idx < self->n_children, NULL);
const GskGLShaderNode *self = (const GskGLShaderNode *) node;
return self->children[idx];
}
@ -5198,11 +5100,9 @@ gsk_gl_shader_node_get_child (GskRenderNode *node,
* Returns: (transfer none): the #GskGLShader shader
*/
GskGLShader *
gsk_gl_shader_node_get_shader (GskRenderNode *node)
gsk_gl_shader_node_get_shader (const GskRenderNode *node)
{
GskGLShaderNode *self = (GskGLShaderNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_GL_SHADER_NODE), 0);
const GskGLShaderNode *self = (const GskGLShaderNode *) node;
return self->shader;
}
@ -5216,11 +5116,9 @@ gsk_gl_shader_node_get_shader (GskRenderNode *node)
* Returns: (transfer none): A #GBytes with the uniform arguments
*/
GBytes *
gsk_gl_shader_node_get_args (GskRenderNode *node)
gsk_gl_shader_node_get_args (const GskRenderNode *node)
{
GskGLShaderNode *self = (GskGLShaderNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_GL_SHADER_NODE), NULL);
const GskGLShaderNode *self = (const GskGLShaderNode *) node;
return self->args;
}

View File

@ -94,7 +94,7 @@ void gsk_render_node_diff_impossible (GskRenderNode
GskRenderNode *node2,
cairo_region_t *region);
bool gsk_border_node_get_uniform (GskRenderNode *self);
bool gsk_border_node_get_uniform (const GskRenderNode *self);
void gsk_text_node_serialize_glyphs (GskRenderNode *self,
GString *str);