forked from AuroraMiddleware/gtk
gdk: Get rid of gdk_drawing_context_get_clip()
Use the identical gdk_draw_context_get_frame_region() instead.
This commit is contained in:
parent
dbe4f1d766
commit
c6ae0ff2d1
@ -1186,7 +1186,6 @@ GDK_IS_MONITOR
|
||||
<SECTION>
|
||||
<FILE>gdkdrawingcontext</FILE>
|
||||
GdkDrawingContext
|
||||
gdk_drawing_context_get_clip
|
||||
gdk_drawing_context_get_paint_context
|
||||
|
||||
<SUBSECTION Standard>
|
||||
|
@ -57,7 +57,6 @@ struct _GdkDrawingContextPrivate {
|
||||
GdkSurface *surface;
|
||||
GdkDrawContext *paint_context;
|
||||
|
||||
cairo_region_t *clip;
|
||||
cairo_t *cr;
|
||||
};
|
||||
|
||||
@ -67,7 +66,6 @@ enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_SURFACE,
|
||||
PROP_CLIP,
|
||||
PROP_PAINT_CONTEXT,
|
||||
|
||||
N_PROPS
|
||||
@ -83,7 +81,6 @@ gdk_drawing_context_dispose (GObject *gobject)
|
||||
|
||||
g_clear_object (&priv->surface);
|
||||
g_clear_object (&priv->paint_context);
|
||||
g_clear_pointer (&priv->clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->cr, cairo_destroy);
|
||||
|
||||
G_OBJECT_CLASS (gdk_drawing_context_parent_class)->dispose (gobject);
|
||||
@ -116,10 +113,6 @@ gdk_drawing_context_set_property (GObject *gobject,
|
||||
priv->paint_context = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
case PROP_CLIP:
|
||||
priv->clip = g_value_dup_boxed (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
@ -140,10 +133,6 @@ gdk_drawing_context_get_property (GObject *gobject,
|
||||
g_value_set_object (value, priv->surface);
|
||||
break;
|
||||
|
||||
case PROP_CLIP:
|
||||
g_value_set_boxed (value, priv->clip);
|
||||
break;
|
||||
|
||||
case PROP_PAINT_CONTEXT:
|
||||
g_value_set_object (value, priv->paint_context);
|
||||
break;
|
||||
@ -173,17 +162,6 @@ gdk_drawing_context_class_init (GdkDrawingContextClass *klass)
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
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:
|
||||
*
|
||||
@ -222,24 +200,3 @@ gdk_drawing_context_get_paint_context (GdkDrawingContext *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;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
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
|
||||
|
||||
|
@ -1612,7 +1612,6 @@ gdk_surface_begin_draw_frame (GdkSurface *surface,
|
||||
context = g_object_new (GDK_TYPE_DRAWING_CONTEXT,
|
||||
"surface", surface,
|
||||
"paint-context", draw_context,
|
||||
"clip", draw_context->frame_region,
|
||||
NULL);
|
||||
|
||||
/* Do not take a reference, to avoid creating cycles */
|
||||
|
@ -2563,7 +2563,7 @@ gsk_gl_renderer_render (GskRenderer *renderer,
|
||||
{
|
||||
GskGLRenderer *self = GSK_GL_RENDERER (renderer);
|
||||
graphene_rect_t viewport;
|
||||
cairo_region_t *damage;
|
||||
const cairo_region_t *damage;
|
||||
GdkDrawingContext *context;
|
||||
GdkRectangle whole_surface;
|
||||
GdkSurface *surface;
|
||||
@ -2582,8 +2582,7 @@ gsk_gl_renderer_render (GskRenderer *renderer,
|
||||
GDK_DRAW_CONTEXT (self->gl_context),
|
||||
update_area);
|
||||
|
||||
damage = gdk_drawing_context_get_clip (context);
|
||||
cairo_region_union (damage, update_area);
|
||||
damage = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->gl_context));
|
||||
|
||||
if (cairo_region_contains_rectangle (damage, &whole_surface) == CAIRO_REGION_OVERLAP_IN)
|
||||
{
|
||||
@ -2594,16 +2593,13 @@ gsk_gl_renderer_render (GskRenderer *renderer,
|
||||
GdkRectangle extents;
|
||||
|
||||
cairo_region_get_extents (damage, &extents);
|
||||
cairo_region_union_rectangle (damage, &extents);
|
||||
|
||||
if (gdk_rectangle_equal (&extents, &whole_surface))
|
||||
self->render_region = NULL;
|
||||
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);
|
||||
gdk_gl_context_make_current (self->gl_context);
|
||||
|
||||
|
@ -219,7 +219,7 @@ gsk_vulkan_renderer_render (GskRenderer *renderer,
|
||||
GskVulkanRender *render;
|
||||
GdkDrawingContext *context;
|
||||
GdkSurface *surface;
|
||||
cairo_region_t *clip;
|
||||
const cairo_region_t *clip;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GskProfiler *profiler;
|
||||
gint64 cpu_time;
|
||||
@ -240,9 +240,8 @@ gsk_vulkan_renderer_render (GskRenderer *renderer,
|
||||
region);
|
||||
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);
|
||||
cairo_region_destroy (clip);
|
||||
|
||||
gsk_vulkan_render_add_node (render, root);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user