Commit c6ae0ff2 authored by Benjamin Otte's avatar Benjamin Otte

gdk: Get rid of gdk_drawing_context_get_clip()

Use the identical gdk_draw_context_get_frame_region() instead.
parent dbe4f1d7
...@@ -1186,7 +1186,6 @@ GDK_IS_MONITOR ...@@ -1186,7 +1186,6 @@ GDK_IS_MONITOR
<SECTION> <SECTION>
<FILE>gdkdrawingcontext</FILE> <FILE>gdkdrawingcontext</FILE>
GdkDrawingContext GdkDrawingContext
gdk_drawing_context_get_clip
gdk_drawing_context_get_paint_context gdk_drawing_context_get_paint_context
<SUBSECTION Standard> <SUBSECTION Standard>
......
...@@ -57,7 +57,6 @@ struct _GdkDrawingContextPrivate { ...@@ -57,7 +57,6 @@ struct _GdkDrawingContextPrivate {
GdkSurface *surface; GdkSurface *surface;
GdkDrawContext *paint_context; GdkDrawContext *paint_context;
cairo_region_t *clip;
cairo_t *cr; cairo_t *cr;
}; };
...@@ -67,7 +66,6 @@ enum { ...@@ -67,7 +66,6 @@ enum {
PROP_0, PROP_0,
PROP_SURFACE, PROP_SURFACE,
PROP_CLIP,
PROP_PAINT_CONTEXT, PROP_PAINT_CONTEXT,
N_PROPS N_PROPS
...@@ -83,7 +81,6 @@ gdk_drawing_context_dispose (GObject *gobject) ...@@ -83,7 +81,6 @@ gdk_drawing_context_dispose (GObject *gobject)
g_clear_object (&priv->surface); g_clear_object (&priv->surface);
g_clear_object (&priv->paint_context); g_clear_object (&priv->paint_context);
g_clear_pointer (&priv->clip, cairo_region_destroy);
g_clear_pointer (&priv->cr, cairo_destroy); g_clear_pointer (&priv->cr, cairo_destroy);
G_OBJECT_CLASS (gdk_drawing_context_parent_class)->dispose (gobject); G_OBJECT_CLASS (gdk_drawing_context_parent_class)->dispose (gobject);
...@@ -116,10 +113,6 @@ gdk_drawing_context_set_property (GObject *gobject, ...@@ -116,10 +113,6 @@ gdk_drawing_context_set_property (GObject *gobject,
priv->paint_context = g_value_dup_object (value); priv->paint_context = g_value_dup_object (value);
break; break;
case PROP_CLIP:
priv->clip = g_value_dup_boxed (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
} }
...@@ -140,10 +133,6 @@ gdk_drawing_context_get_property (GObject *gobject, ...@@ -140,10 +133,6 @@ gdk_drawing_context_get_property (GObject *gobject,
g_value_set_object (value, priv->surface); g_value_set_object (value, priv->surface);
break; break;
case PROP_CLIP:
g_value_set_boxed (value, priv->clip);
break;
case PROP_PAINT_CONTEXT: case PROP_PAINT_CONTEXT:
g_value_set_object (value, priv->paint_context); g_value_set_object (value, priv->paint_context);
break; break;
...@@ -173,17 +162,6 @@ gdk_drawing_context_class_init (GdkDrawingContextClass *klass) ...@@ -173,17 +162,6 @@ gdk_drawing_context_class_init (GdkDrawingContextClass *klass)
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS); G_PARAM_STATIC_STRINGS);
/**
* GdkDrawingContext:clip:
*
* The clip region applied to the drawing context.
*/
obj_property[PROP_CLIP] =
g_param_spec_boxed ("clip", "Clip", "The clip region of the context",
CAIRO_GOBJECT_TYPE_REGION,
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
/** /**
* GdkDrawingContext:paint-context: * GdkDrawingContext:paint-context:
* *
...@@ -222,24 +200,3 @@ gdk_drawing_context_get_paint_context (GdkDrawingContext *context) ...@@ -222,24 +200,3 @@ gdk_drawing_context_get_paint_context (GdkDrawingContext *context)
return priv->paint_context; return priv->paint_context;
} }
/**
* gdk_drawing_context_get_clip:
* @context: a #GdkDrawingContext
*
* Retrieves a copy of the clip region used when creating the @context.
*
* Returns: (transfer full) (nullable): a Cairo region
*/
cairo_region_t *
gdk_drawing_context_get_clip (GdkDrawingContext *context)
{
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_DRAWING_CONTEXT (context), NULL);
if (priv->clip == NULL)
return NULL;
return cairo_region_copy (priv->clip);
}
...@@ -38,8 +38,6 @@ GType gdk_drawing_context_get_type (void) G_GNUC_CONST; ...@@ -38,8 +38,6 @@ GType gdk_drawing_context_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkDrawContext* gdk_drawing_context_get_paint_context (GdkDrawingContext *context); GdkDrawContext* gdk_drawing_context_get_paint_context (GdkDrawingContext *context);
GDK_AVAILABLE_IN_ALL
cairo_region_t *gdk_drawing_context_get_clip (GdkDrawingContext *context);
G_END_DECLS G_END_DECLS
......
...@@ -1612,7 +1612,6 @@ gdk_surface_begin_draw_frame (GdkSurface *surface, ...@@ -1612,7 +1612,6 @@ gdk_surface_begin_draw_frame (GdkSurface *surface,
context = g_object_new (GDK_TYPE_DRAWING_CONTEXT, context = g_object_new (GDK_TYPE_DRAWING_CONTEXT,
"surface", surface, "surface", surface,
"paint-context", draw_context, "paint-context", draw_context,
"clip", draw_context->frame_region,
NULL); NULL);
/* Do not take a reference, to avoid creating cycles */ /* Do not take a reference, to avoid creating cycles */
......
...@@ -2563,7 +2563,7 @@ gsk_gl_renderer_render (GskRenderer *renderer, ...@@ -2563,7 +2563,7 @@ gsk_gl_renderer_render (GskRenderer *renderer,
{ {
GskGLRenderer *self = GSK_GL_RENDERER (renderer); GskGLRenderer *self = GSK_GL_RENDERER (renderer);
graphene_rect_t viewport; graphene_rect_t viewport;
cairo_region_t *damage; const cairo_region_t *damage;
GdkDrawingContext *context; GdkDrawingContext *context;
GdkRectangle whole_surface; GdkRectangle whole_surface;
GdkSurface *surface; GdkSurface *surface;
...@@ -2582,8 +2582,7 @@ gsk_gl_renderer_render (GskRenderer *renderer, ...@@ -2582,8 +2582,7 @@ gsk_gl_renderer_render (GskRenderer *renderer,
GDK_DRAW_CONTEXT (self->gl_context), GDK_DRAW_CONTEXT (self->gl_context),
update_area); update_area);
damage = gdk_drawing_context_get_clip (context); damage = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->gl_context));
cairo_region_union (damage, update_area);
if (cairo_region_contains_rectangle (damage, &whole_surface) == CAIRO_REGION_OVERLAP_IN) if (cairo_region_contains_rectangle (damage, &whole_surface) == CAIRO_REGION_OVERLAP_IN)
{ {
...@@ -2594,16 +2593,13 @@ gsk_gl_renderer_render (GskRenderer *renderer, ...@@ -2594,16 +2593,13 @@ gsk_gl_renderer_render (GskRenderer *renderer,
GdkRectangle extents; GdkRectangle extents;
cairo_region_get_extents (damage, &extents); cairo_region_get_extents (damage, &extents);
cairo_region_union_rectangle (damage, &extents);
if (gdk_rectangle_equal (&extents, &whole_surface)) if (gdk_rectangle_equal (&extents, &whole_surface))
self->render_region = NULL; self->render_region = NULL;
else else
self->render_region = cairo_region_reference (damage); self->render_region = cairo_region_create_rectangle (&extents);
} }
cairo_region_destroy (damage);
self->scale_factor = gdk_surface_get_scale_factor (surface); self->scale_factor = gdk_surface_get_scale_factor (surface);
gdk_gl_context_make_current (self->gl_context); gdk_gl_context_make_current (self->gl_context);
......
...@@ -219,7 +219,7 @@ gsk_vulkan_renderer_render (GskRenderer *renderer, ...@@ -219,7 +219,7 @@ gsk_vulkan_renderer_render (GskRenderer *renderer,
GskVulkanRender *render; GskVulkanRender *render;
GdkDrawingContext *context; GdkDrawingContext *context;
GdkSurface *surface; GdkSurface *surface;
cairo_region_t *clip; const cairo_region_t *clip;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
GskProfiler *profiler; GskProfiler *profiler;
gint64 cpu_time; gint64 cpu_time;
...@@ -240,9 +240,8 @@ gsk_vulkan_renderer_render (GskRenderer *renderer, ...@@ -240,9 +240,8 @@ gsk_vulkan_renderer_render (GskRenderer *renderer,
region); region);
render = self->render; render = self->render;
clip = gdk_drawing_context_get_clip (context); clip = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->vulkan));
gsk_vulkan_render_reset (render, self->targets[gdk_vulkan_context_get_draw_index (self->vulkan)], NULL, clip); gsk_vulkan_render_reset (render, self->targets[gdk_vulkan_context_get_draw_index (self->vulkan)], NULL, clip);
cairo_region_destroy (clip);
gsk_vulkan_render_add_node (render, root); gsk_vulkan_render_add_node (render, root);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment