gdk: Get rid of GdkDrawingContext

All information is kept in GdkDrawContext these days, so use that one.
This commit is contained in:
Benjamin Otte 2018-04-21 01:22:19 +02:00
parent c6ae0ff2d1
commit 48fc18c37b
18 changed files with 38 additions and 388 deletions

View File

@ -1183,22 +1183,6 @@ GDK_MONITOR
GDK_IS_MONITOR GDK_IS_MONITOR
</SECTION> </SECTION>
<SECTION>
<FILE>gdkdrawingcontext</FILE>
GdkDrawingContext
gdk_drawing_context_get_paint_context
<SUBSECTION Standard>
gdk_drawing_context_get_type
GdkDrawingContextClass
GDK_TYPE_DRAWING_CONTEXT
GDK_DRAWING_CONTEXT_CLASS
GDK_DRAWING_CONTEXT_GET_CLASS
GDK_IS_DRAWING_CONTEXT_CLASS
GDK_DRAWING_CONTEXT
GDK_IS_DRAWING_CONTEXT
</SECTION>
<SECTION> <SECTION>
<FILE>gdkcairocontext</FILE> <FILE>gdkcairocontext</FILE>
GdkCairoContext GdkCairoContext

View File

@ -46,7 +46,6 @@
#include <gdk/gdkdisplaymanager.h> #include <gdk/gdkdisplaymanager.h>
#include <gdk/gdkdnd.h> #include <gdk/gdkdnd.h>
#include <gdk/gdkdrawcontext.h> #include <gdk/gdkdrawcontext.h>
#include <gdk/gdkdrawingcontext.h>
#include <gdk/gdkenumtypes.h> #include <gdk/gdkenumtypes.h>
#include <gdk/gdkevents.h> #include <gdk/gdkevents.h>
#include <gdk/gdkframeclock.h> #include <gdk/gdkframeclock.h>

View File

@ -24,7 +24,6 @@
#include <gdk/gdkversionmacros.h> #include <gdk/gdkversionmacros.h>
#include <gdk/gdkrgba.h> #include <gdk/gdkrgba.h>
#include <gdk/gdkdrawingcontext.h>
#include <gdk/gdkpixbuf.h> #include <gdk/gdkpixbuf.h>
#include <pango/pangocairo.h> #include <pango/pangocairo.h>

View File

@ -80,26 +80,24 @@ gdk_surface_get_content (GdkSurface *surface)
static cairo_t * static cairo_t *
gdk_cairo_context_default_cairo_create (GdkCairoContext *self) gdk_cairo_context_default_cairo_create (GdkCairoContext *self)
{ {
GdkDrawContext *context;
GdkSurface *surface; GdkSurface *surface;
cairo_region_t *region;
cairo_surface_t *cairo_surface; cairo_surface_t *cairo_surface;
cairo_t *cr; cairo_t *cr;
g_return_val_if_fail (GDK_IS_CAIRO_CONTEXT (self), NULL); g_return_val_if_fail (GDK_IS_CAIRO_CONTEXT (self), NULL);
surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (self)); context = GDK_DRAW_CONTEXT (self);
if (surface->drawing_context == NULL || if (!gdk_draw_context_is_drawing (context))
gdk_drawing_context_get_paint_context (surface->drawing_context) != GDK_DRAW_CONTEXT (self))
return NULL; return NULL;
surface = gdk_draw_context_get_surface (context);
cairo_surface = _gdk_surface_ref_cairo_surface (surface); cairo_surface = _gdk_surface_ref_cairo_surface (surface);
cr = cairo_create (cairo_surface); cr = cairo_create (cairo_surface);
region = gdk_surface_get_current_paint_region (surface); gdk_cairo_region (cr, gdk_draw_context_get_frame_region (context));
gdk_cairo_region (cr, region);
cairo_clip (cr); cairo_clip (cr);
cairo_region_destroy (region);
cairo_surface_destroy (cairo_surface); cairo_surface_destroy (cairo_surface);
return cr; return cr;

View File

@ -1,202 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright 2016 Endless
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:gdkdrawingcontext
* @Title: GdkDrawingContext
* @Short_description: Drawing context for GDK surfaces
*
* #GdkDrawingContext is an object that represents the current drawing
* state of a #GdkSurface.
*
* It's possible to use a #GdkDrawingContext to draw on a #GdkSurface
* via rendering API like Cairo or OpenGL.
*
* A #GdkDrawingContext can only be created by calling gdk_surface_begin_draw_frame()
* and will be valid until a call to gdk_surface_end_draw_frame().
*
* #GdkDrawingContext is available since GDK 3.22
*/
/**
* GdkDrawingContext:
*
* The GdkDrawingContext struct contains only private fields and should not
* be accessed directly.
*/
#include "config.h"
#include <cairo-gobject.h>
#include "gdkdrawingcontextprivate.h"
#include "gdkrectangle.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdksurfaceimpl.h"
#include "gdk-private.h"
typedef struct _GdkDrawingContextPrivate GdkDrawingContextPrivate;
struct _GdkDrawingContextPrivate {
GdkSurface *surface;
GdkDrawContext *paint_context;
cairo_t *cr;
};
G_DEFINE_TYPE_WITH_PRIVATE (GdkDrawingContext, gdk_drawing_context, G_TYPE_OBJECT)
enum {
PROP_0,
PROP_SURFACE,
PROP_PAINT_CONTEXT,
N_PROPS
};
static GParamSpec *obj_property[N_PROPS];
static void
gdk_drawing_context_dispose (GObject *gobject)
{
GdkDrawingContext *self = GDK_DRAWING_CONTEXT (gobject);
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (self);
g_clear_object (&priv->surface);
g_clear_object (&priv->paint_context);
g_clear_pointer (&priv->cr, cairo_destroy);
G_OBJECT_CLASS (gdk_drawing_context_parent_class)->dispose (gobject);
}
static void
gdk_drawing_context_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GdkDrawingContext *self = GDK_DRAWING_CONTEXT (gobject);
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (self);
switch (prop_id)
{
case PROP_SURFACE:
priv->surface = g_value_dup_object (value);
if (priv->surface == NULL)
{
g_critical ("The drawing context of type %s does not have a surface "
"associated to it. Drawing contexts can only be created "
"using gdk_surface_begin_draw_frame().",
G_OBJECT_TYPE_NAME (gobject));
return;
}
break;
case PROP_PAINT_CONTEXT:
priv->paint_context = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
gdk_drawing_context_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdkDrawingContext *self = GDK_DRAWING_CONTEXT (gobject);
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (self);
switch (prop_id)
{
case PROP_SURFACE:
g_value_set_object (value, priv->surface);
break;
case PROP_PAINT_CONTEXT:
g_value_set_object (value, priv->paint_context);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
gdk_drawing_context_class_init (GdkDrawingContextClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gdk_drawing_context_set_property;
gobject_class->get_property = gdk_drawing_context_get_property;
gobject_class->dispose = gdk_drawing_context_dispose;
/**
* GdkDrawingContext:surface:
*
* The #GdkSurface that created the drawing context.
*/
obj_property[PROP_SURFACE] =
g_param_spec_object ("surface", "Surface", "The surface that created the context",
GDK_TYPE_SURFACE,
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
/**
* GdkDrawingContext:paint-context:
*
* The #GdkDrawContext used to draw or %NULL if Cairo is used.
*/
obj_property[PROP_PAINT_CONTEXT] =
g_param_spec_object ("paint-context", "Paint context", "The context used to draw",
GDK_TYPE_DRAW_CONTEXT,
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, N_PROPS, obj_property);
}
static void
gdk_drawing_context_init (GdkDrawingContext *self)
{
}
/**
* gdk_drawing_context_get_paint_context:
* @context: a #GdkDrawingContext
*
* Retrieves the paint context used to draw with.
*
* Returns: (transfer none): a #GdkDrawContext or %NULL
*/
GdkDrawContext *
gdk_drawing_context_get_paint_context (GdkDrawingContext *context)
{
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_DRAWING_CONTEXT (context), NULL);
return priv->paint_context;
}

View File

@ -1,44 +0,0 @@
/* GDK - The GIMP Drawing Kit
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_DRAWING_CONTEXT_H__
#define __GDK_DRAWING_CONTEXT_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS
#define GDK_TYPE_DRAWING_CONTEXT (gdk_drawing_context_get_type ())
#define GDK_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_DRAWING_CONTEXT, GdkDrawingContext))
#define GDK_IS_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_DRAWING_CONTEXT))
typedef struct _GdkDrawingContextClass GdkDrawingContextClass;
GDK_AVAILABLE_IN_ALL
GType gdk_drawing_context_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDrawContext* gdk_drawing_context_get_paint_context (GdkDrawingContext *context);
G_END_DECLS
#endif /* __GDK_DRAWING_CONTEXT_H__ */

View File

@ -1,24 +0,0 @@
#ifndef __GDK_DRAWING_CONTEXT_PRIVATE_H__
#define __GDK_DRAWING_CONTEXT_PRIVATE_H__
#include "gdkdrawingcontext.h"
G_BEGIN_DECLS
#define GDK_DRAWING_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWING_CONTEXT, GdkDrawingContextClass))
#define GDK_IS_DRAWING_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWING_CONTEXT))
#define GDK_DRAWING_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWING_CONTEXT, GdkDrawingContextClass))
struct _GdkDrawingContext
{
GObject parent_instance;
};
struct _GdkDrawingContextClass
{
GObjectClass parent_instance;
};
G_END_DECLS
#endif /* __GDK_DRAWING_CONTEXT_PRIVATE_H__ */

View File

@ -221,7 +221,7 @@ struct _GdkSurface
GdkFrameClock *frame_clock; /* NULL to use from parent or default */ GdkFrameClock *frame_clock; /* NULL to use from parent or default */
GSList *draw_contexts; GSList *draw_contexts;
GdkDrawingContext *drawing_context; GdkDrawContext *paint_context;
cairo_region_t *opaque_region; cairo_region_t *opaque_region;
}; };
@ -286,9 +286,6 @@ void gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr); cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
void gdk_cairo_set_drawing_context (cairo_t *cr,
GdkDrawingContext *context);
/************************************* /*************************************
* Interfaces used by windowing code * * Interfaces used by windowing code *
*************************************/ *************************************/
@ -310,8 +307,6 @@ void gdk_surface_get_unscaled_size (GdkSurface *surface,
int *unscaled_width, int *unscaled_width,
int *unscaled_height); int *unscaled_height);
GdkDrawingContext *gdk_surface_get_drawing_context (GdkSurface *surface);
cairo_region_t *gdk_surface_get_current_paint_region (GdkSurface *surface); cairo_region_t *gdk_surface_get_current_paint_region (GdkSurface *surface);
/***************************************** /*****************************************

View File

@ -38,7 +38,6 @@
#include "gdkmarshalers.h" #include "gdkmarshalers.h"
#include "gdksurfaceimpl.h" #include "gdksurfaceimpl.h"
#include "gdkglcontextprivate.h" #include "gdkglcontextprivate.h"
#include "gdkdrawingcontextprivate.h"
#include "gdk-private.h" #include "gdk-private.h"
#include <math.h> #include <math.h>
@ -1549,7 +1548,7 @@ gdk_surface_create_vulkan_context (GdkSurface *surface,
* @region: a Cairo region * @region: a Cairo region
* *
* Indicates that you are beginning the process of redrawing @region * Indicates that you are beginning the process of redrawing @region
* on @surface, and provides you with a #GdkDrawingContext. * on @surface.
* *
* If @surface is a top level #GdkSurface, backed by a native surface * If @surface is a top level #GdkSurface, backed by a native surface
* implementation, a backing store (offscreen buffer) large enough to * implementation, a backing store (offscreen buffer) large enough to
@ -1575,94 +1574,72 @@ gdk_surface_create_vulkan_context (GdkSurface *surface,
* and already has a backing store. Therefore in most cases, application * and already has a backing store. Therefore in most cases, application
* code in GTK does not need to call gdk_surface_begin_draw_frame() * code in GTK does not need to call gdk_surface_begin_draw_frame()
* explicitly. * explicitly.
*
* Returns: (transfer none): a #GdkDrawingContext context that should be
* used to draw the contents of the surface; the returned context is owned
* by GDK.
*/ */
GdkDrawingContext * void
gdk_surface_begin_draw_frame (GdkSurface *surface, gdk_surface_begin_draw_frame (GdkSurface *surface,
GdkDrawContext *draw_context, GdkDrawContext *draw_context,
const cairo_region_t *region) const cairo_region_t *region)
{ {
GdkDrawingContext *context; g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (gdk_surface_has_native (surface));
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL); g_return_if_fail (gdk_surface_is_toplevel (surface));
g_return_val_if_fail (gdk_surface_has_native (surface), NULL); g_return_if_fail (GDK_IS_DRAW_CONTEXT (draw_context));
g_return_val_if_fail (gdk_surface_is_toplevel (surface), NULL); g_return_if_fail (gdk_draw_context_get_surface (draw_context) == surface);
g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (draw_context), NULL); g_return_if_fail (region != NULL);
g_return_val_if_fail (gdk_draw_context_get_surface (draw_context) == surface, NULL);
g_return_val_if_fail (region != NULL, NULL);
if (GDK_SURFACE_DESTROYED (surface)) if (GDK_SURFACE_DESTROYED (surface))
return NULL; return;
if (surface->drawing_context != NULL) if (surface->paint_context != NULL)
{ {
g_critical ("The surface %p already has a drawing context. You cannot " g_critical ("The surface %p already has a drawing context. You cannot "
"call gdk_surface_begin_draw_frame() without calling " "call gdk_surface_begin_draw_frame() without calling "
"gdk_surface_end_draw_frame() first.", surface); "gdk_surface_end_draw_frame() first.", surface);
return NULL; return;
} }
draw_context->frame_region = cairo_region_copy (region); draw_context->frame_region = cairo_region_copy (region);
gdk_draw_context_begin_frame (draw_context, draw_context->frame_region); gdk_draw_context_begin_frame (draw_context, draw_context->frame_region);
context = g_object_new (GDK_TYPE_DRAWING_CONTEXT, surface->paint_context = g_object_ref (draw_context);
"surface", surface,
"paint-context", draw_context,
NULL);
/* Do not take a reference, to avoid creating cycles */
surface->drawing_context = context;
return context;
} }
/** /**
* gdk_surface_end_draw_frame: * gdk_surface_end_draw_frame:
* @surface: a #GdkSurface * @surface: a #GdkSurface
* @context: the #GdkDrawingContext created by gdk_surface_begin_draw_frame()
* *
* Indicates that the drawing of the contents of @surface started with * Indicates that the drawing of the contents of @surface started with
* gdk_surface_begin_frame() has been completed. * gdk_surface_begin_frame() has been completed.
* *
* This function will take care of destroying the #GdkDrawingContext.
*
* It is an error to call this function without a matching * It is an error to call this function without a matching
* gdk_surface_begin_frame() first. * gdk_surface_begin_frame() first.
*/ */
void void
gdk_surface_end_draw_frame (GdkSurface *surface, gdk_surface_end_draw_frame (GdkSurface *surface)
GdkDrawingContext *context)
{ {
GdkDrawContext *paint_context; GdkDrawContext *paint_context;
g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (GDK_IS_DRAWING_CONTEXT (context));
if (GDK_SURFACE_DESTROYED (surface)) if (GDK_SURFACE_DESTROYED (surface))
return; return;
if (surface->drawing_context == NULL) if (surface->paint_context == NULL)
{ {
g_critical ("The surface %p has no drawing context. You must call " g_critical ("The surface %p has no drawing context. You must call "
"gdk_surface_begin_draw_frame() before calling " "gdk_surface_begin_draw_frame() before calling "
"gdk_surface_end_draw_frame().", surface); "gdk_surface_end_draw_frame().", surface);
return; return;
} }
g_return_if_fail (surface->drawing_context == context);
paint_context = gdk_drawing_context_get_paint_context (context); paint_context = g_steal_pointer (&surface->paint_context);
gdk_draw_context_end_frame (paint_context, gdk_draw_context_end_frame (paint_context,
paint_context->frame_region, paint_context->frame_region,
surface->active_update_area); surface->active_update_area);
surface->drawing_context = NULL;
g_clear_pointer (&paint_context->frame_region, cairo_region_destroy); g_clear_pointer (&paint_context->frame_region, cairo_region_destroy);
g_object_unref (context); g_object_unref (paint_context);
} }
/*< private > /*< private >
@ -1691,26 +1668,6 @@ gdk_surface_get_current_paint_region (GdkSurface *surface)
return region; return region;
} }
/*< private >
* gdk_surface_get_drawing_context:
* @surface: a #GdkSurface
*
* Retrieves the #GdkDrawingContext associated to @surface by
* gdk_surface_begin_draw_frame().
*
* Returns: (transfer none) (nullable): a #GdkDrawingContext, if any is set
*/
GdkDrawingContext *
gdk_surface_get_drawing_context (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
if (GDK_SURFACE_DESTROYED (surface))
return NULL;
return surface->drawing_context;
}
/* This is used in places like gdk_cairo_set_source_surface and /* This is used in places like gdk_cairo_set_source_surface and
* other places to take "screenshots" of surfaces. Thus, we allow * other places to take "screenshots" of surfaces. Thus, we allow
* it to be used outside of a begin_paint / end_paint. */ * it to be used outside of a begin_paint / end_paint. */

View File

@ -31,7 +31,6 @@
#include <gdk/gdkversionmacros.h> #include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h> #include <gdk/gdktypes.h>
#include <gdk/gdkdrawingcontext.h>
#include <gdk/gdkevents.h> #include <gdk/gdkevents.h>
#include <gdk/gdkframeclock.h> #include <gdk/gdkframeclock.h>
#include <gdk/gdkmonitor.h> #include <gdk/gdkmonitor.h>
@ -577,12 +576,11 @@ void gdk_surface_set_geometry_hints (GdkSurface *surface,
GdkSurfaceHints geom_mask); GdkSurfaceHints geom_mask);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkDrawingContext *gdk_surface_begin_draw_frame (GdkSurface *surface, void gdk_surface_begin_draw_frame (GdkSurface *surface,
GdkDrawContext *context, GdkDrawContext *context,
const cairo_region_t *region); const cairo_region_t *region);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gdk_surface_end_draw_frame (GdkSurface *surface, void gdk_surface_end_draw_frame (GdkSurface *surface);
GdkDrawingContext *context);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gdk_surface_set_title (GdkSurface *surface, void gdk_surface_set_title (GdkSurface *surface,

View File

@ -17,7 +17,6 @@ gdk_public_sources = files([
'gdkdisplaymanager.c', 'gdkdisplaymanager.c',
'gdkdnd.c', 'gdkdnd.c',
'gdkdrawcontext.c', 'gdkdrawcontext.c',
'gdkdrawingcontext.c',
'gdkevents.c', 'gdkevents.c',
'gdkframeclock.c', 'gdkframeclock.c',
'gdkframeclockidle.c', 'gdkframeclockidle.c',
@ -67,7 +66,6 @@ gdk_public_headers = files([
'gdkdisplaymanager.h', 'gdkdisplaymanager.h',
'gdkdnd.h', 'gdkdnd.h',
'gdkdrawcontext.h', 'gdkdrawcontext.h',
'gdkdrawingcontext.h',
'gdkevents.h', 'gdkevents.h',
'gdkframeclock.h', 'gdkframeclock.h',
'gdkframetimings.h', 'gdkframetimings.h',
@ -97,7 +95,6 @@ gdk_sources = gdk_public_sources
gdk_private_h_sources = files([ gdk_private_h_sources = files([
'gdkeventsprivate.h', 'gdkeventsprivate.h',
'gdkdevicetoolprivate.h', 'gdkdevicetoolprivate.h',
'gdkdrawingcontextprivate.h',
'gdkmonitorprivate.h', 'gdkmonitorprivate.h',
'gdkseatdefaultprivate.h', 'gdkseatdefaultprivate.h',
]) ])

View File

@ -2564,7 +2564,6 @@ 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;
const cairo_region_t *damage; const cairo_region_t *damage;
GdkDrawingContext *context;
GdkRectangle whole_surface; GdkRectangle whole_surface;
GdkSurface *surface; GdkSurface *surface;
@ -2578,9 +2577,9 @@ gsk_gl_renderer_render (GskRenderer *renderer,
gdk_surface_get_height (surface) * self->scale_factor gdk_surface_get_height (surface) * self->scale_factor
}; };
context = gdk_surface_begin_draw_frame (surface, gdk_surface_begin_draw_frame (surface,
GDK_DRAW_CONTEXT (self->gl_context), GDK_DRAW_CONTEXT (self->gl_context),
update_area); update_area);
damage = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->gl_context)); damage = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->gl_context));
@ -2613,7 +2612,7 @@ gsk_gl_renderer_render (GskRenderer *renderer,
gdk_gl_context_make_current (self->gl_context); gdk_gl_context_make_current (self->gl_context);
gsk_gl_renderer_clear_tree (self); gsk_gl_renderer_clear_tree (self);
gdk_surface_end_draw_frame (surface, context); gdk_surface_end_draw_frame (surface);
g_clear_pointer (&self->render_region, cairo_region_destroy); g_clear_pointer (&self->render_region, cairo_region_destroy);
} }

View File

@ -673,7 +673,6 @@ gsk_broadway_renderer_render (GskRenderer *self,
GArray *nodes; GArray *nodes;
GPtrArray *node_textures; GPtrArray *node_textures;
cairo_region_t *whole; cairo_region_t *whole;
GdkDrawingContext *context;
GdkSurface *surface; GdkSurface *surface;
surface = gsk_renderer_get_surface (self); surface = gsk_renderer_get_surface (self);
@ -682,7 +681,7 @@ gsk_broadway_renderer_render (GskRenderer *self,
gdk_surface_get_width (surface), gdk_surface_get_width (surface),
gdk_surface_get_height (surface) gdk_surface_get_height (surface)
}); });
context = gdk_surface_begin_draw_frame (surface, NULL, whole); gdk_surface_begin_draw_frame (surface, NULL, whole);
cairo_region_destroy (whole); cairo_region_destroy (whole);
nodes = g_array_new (FALSE, FALSE, sizeof(guint32)); nodes = g_array_new (FALSE, FALSE, sizeof(guint32));
@ -692,7 +691,7 @@ gsk_broadway_renderer_render (GskRenderer *self,
g_array_unref (nodes); g_array_unref (nodes);
g_ptr_array_unref (node_textures); g_ptr_array_unref (node_textures);
gdk_surface_end_draw_frame (surface, context); gdk_surface_end_draw_frame (surface);
} }
static void static void

View File

@ -109,12 +109,11 @@ gsk_cairo_renderer_render (GskRenderer *renderer,
{ {
GskCairoRenderer *self = GSK_CAIRO_RENDERER (renderer); GskCairoRenderer *self = GSK_CAIRO_RENDERER (renderer);
GdkSurface *surface = gsk_renderer_get_surface (renderer); GdkSurface *surface = gsk_renderer_get_surface (renderer);
GdkDrawingContext *context;
cairo_t *cr; cairo_t *cr;
context = gdk_surface_begin_draw_frame (surface, gdk_surface_begin_draw_frame (surface,
GDK_DRAW_CONTEXT (self->cairo_context), GDK_DRAW_CONTEXT (self->cairo_context),
region); region);
cr = gdk_cairo_context_cairo_create (self->cairo_context); cr = gdk_cairo_context_cairo_create (self->cairo_context);
g_return_if_fail (cr != NULL); g_return_if_fail (cr != NULL);
@ -137,7 +136,7 @@ gsk_cairo_renderer_render (GskRenderer *renderer,
cairo_destroy (cr); cairo_destroy (cr);
gdk_surface_end_draw_frame (surface, context); gdk_surface_end_draw_frame (surface);
} }
static void static void

View File

@ -217,7 +217,6 @@ gsk_vulkan_renderer_render (GskRenderer *renderer,
{ {
GskVulkanRenderer *self = GSK_VULKAN_RENDERER (renderer); GskVulkanRenderer *self = GSK_VULKAN_RENDERER (renderer);
GskVulkanRender *render; GskVulkanRender *render;
GdkDrawingContext *context;
GdkSurface *surface; GdkSurface *surface;
const cairo_region_t *clip; const cairo_region_t *clip;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
@ -235,9 +234,9 @@ gsk_vulkan_renderer_render (GskRenderer *renderer,
gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time); gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time);
#endif #endif
context = gdk_surface_begin_draw_frame (surface, gdk_surface_begin_draw_frame (surface,
GDK_DRAW_CONTEXT (self->vulkan), GDK_DRAW_CONTEXT (self->vulkan),
region); region);
render = self->render; render = self->render;
clip = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->vulkan)); clip = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->vulkan));
@ -258,7 +257,7 @@ gsk_vulkan_renderer_render (GskRenderer *renderer,
gsk_profiler_push_samples (profiler); gsk_profiler_push_samples (profiler);
#endif #endif
gdk_surface_end_draw_frame (surface, context); gdk_surface_end_draw_frame (surface);
} }
static void static void

View File

@ -77,7 +77,6 @@ test_type (gconstpointer data)
/* These can't be freely constructed/destroyed */ /* These can't be freely constructed/destroyed */
if (g_type_is_a (type, GTK_TYPE_APPLICATION) || if (g_type_is_a (type, GTK_TYPE_APPLICATION) ||
g_type_is_a (type, GDK_TYPE_PIXBUF_LOADER) || g_type_is_a (type, GDK_TYPE_PIXBUF_LOADER) ||
g_type_is_a (type, GDK_TYPE_DRAWING_CONTEXT) ||
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
g_type_is_a (type, GTK_TYPE_PRINT_JOB) || g_type_is_a (type, GTK_TYPE_PRINT_JOB) ||
#endif #endif

View File

@ -368,7 +368,6 @@ test_type (gconstpointer data)
/* These can't be freely constructed/destroyed */ /* These can't be freely constructed/destroyed */
if (g_type_is_a (type, GTK_TYPE_APPLICATION) || if (g_type_is_a (type, GTK_TYPE_APPLICATION) ||
g_type_is_a (type, GDK_TYPE_PIXBUF_LOADER) || g_type_is_a (type, GDK_TYPE_PIXBUF_LOADER) ||
g_type_is_a (type, GDK_TYPE_DRAWING_CONTEXT) ||
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
g_type_is_a (type, GTK_TYPE_PRINT_JOB) || g_type_is_a (type, GTK_TYPE_PRINT_JOB) ||
#endif #endif

View File

@ -116,7 +116,6 @@ main (int argc, char **argv)
#endif #endif
/* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */ /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */
all_types[i] != GDK_TYPE_PIXBUF_LOADER && all_types[i] != GDK_TYPE_PIXBUF_LOADER &&
all_types[i] != GDK_TYPE_DRAWING_CONTEXT &&
all_types[i] != gdk_pixbuf_simple_anim_iter_get_type()) all_types[i] != gdk_pixbuf_simple_anim_iter_get_type())
{ {
gchar *test_path = g_strdup_printf ("/FinalizeObject/%s", g_type_name (all_types[i])); gchar *test_path = g_strdup_printf ("/FinalizeObject/%s", g_type_name (all_types[i]));