mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
API: Require passing a GLContext to begin_draw_frame()
This is in preparation for requiring explicit passing of GL contexts when drawing.
This commit is contained in:
parent
9c041f6bcc
commit
332ed7be5b
@ -63,6 +63,7 @@ enum {
|
||||
|
||||
PROP_WINDOW,
|
||||
PROP_CLIP,
|
||||
PROP_PAINT_CONTEXT,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
@ -110,9 +111,9 @@ gdk_drawing_context_set_property (GObject *gobject,
|
||||
G_OBJECT_TYPE_NAME (gobject));
|
||||
return;
|
||||
}
|
||||
priv->paint_context = priv->window->gl_paint_context;
|
||||
if (priv->paint_context)
|
||||
g_object_ref (priv->paint_context);
|
||||
|
||||
case PROP_PAINT_CONTEXT:
|
||||
priv->paint_context = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
case PROP_CLIP:
|
||||
@ -143,6 +144,10 @@ gdk_drawing_context_get_property (GObject *gobject,
|
||||
g_value_set_boxed (value, priv->clip);
|
||||
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);
|
||||
}
|
||||
@ -183,6 +188,19 @@ gdk_drawing_context_class_init (GdkDrawingContextClass *klass)
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
/**
|
||||
* GdkDrawingContext:paint-context:
|
||||
*
|
||||
* The #GdkGLContext used to draw or %NULL if Cairo is used.
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
obj_property[PROP_PAINT_CONTEXT] =
|
||||
g_param_spec_object ("paint-context", "Paint context", "The context used to draw",
|
||||
GDK_TYPE_GL_CONTEXT,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, obj_property);
|
||||
}
|
||||
@ -287,6 +305,26 @@ gdk_drawing_context_get_window (GdkDrawingContext *context)
|
||||
return priv->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawing_context_get_paint_context:
|
||||
* @context: a #GdkDrawingContext
|
||||
*
|
||||
* Retrieves the paint context used to draw with.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkGLContext or %NULL
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
GdkGLContext *
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawing_context_get_clip:
|
||||
* @context: a #GdkDrawingContext
|
||||
|
@ -38,6 +38,8 @@ GType gdk_drawing_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GdkWindow * gdk_drawing_context_get_window (GdkDrawingContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GdkGLContext* gdk_drawing_context_get_paint_context (GdkDrawingContext *context);
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
cairo_region_t *gdk_drawing_context_get_clip (GdkDrawingContext *context);
|
||||
|
||||
|
@ -2856,6 +2856,7 @@ gdk_window_end_paint_internal (GdkWindow *window)
|
||||
/**
|
||||
* gdk_window_begin_draw_frame:
|
||||
* @window: a #GdkWindow
|
||||
* @context: (allow-none): the context used to draw the frame
|
||||
* @region: a Cairo region
|
||||
*
|
||||
* Indicates that you are beginning the process of redrawing @region
|
||||
@ -2894,6 +2895,7 @@ gdk_window_end_paint_internal (GdkWindow *window)
|
||||
*/
|
||||
GdkDrawingContext *
|
||||
gdk_window_begin_draw_frame (GdkWindow *window,
|
||||
GdkGLContext *gl_context,
|
||||
const cairo_region_t *region)
|
||||
{
|
||||
GdkDrawingContext *context;
|
||||
@ -2901,6 +2903,11 @@ gdk_window_begin_draw_frame (GdkWindow *window,
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
|
||||
g_return_val_if_fail (gdk_window_has_native (window), NULL);
|
||||
g_return_val_if_fail (gdk_window_is_toplevel (window), NULL);
|
||||
if (gl_context != NULL)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (gl_context), NULL);
|
||||
g_return_val_if_fail (gdk_gl_context_get_window (gl_context) == window, NULL);
|
||||
}
|
||||
|
||||
if (window->drawing_context != NULL)
|
||||
{
|
||||
@ -2912,6 +2919,7 @@ gdk_window_begin_draw_frame (GdkWindow *window,
|
||||
|
||||
context = g_object_new (GDK_TYPE_DRAWING_CONTEXT,
|
||||
"window", window,
|
||||
"paint-context", gl_context,
|
||||
"clip", region,
|
||||
NULL);
|
||||
|
||||
|
@ -626,8 +626,9 @@ GDK_AVAILABLE_IN_3_16
|
||||
void gdk_window_mark_paint_from_clip (GdkWindow *window,
|
||||
cairo_t *cr);
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GdkDrawingContext *gdk_window_begin_draw_frame (GdkWindow *window,
|
||||
GdkGLContext *context,
|
||||
const cairo_region_t *region);
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
void gdk_window_end_draw_frame (GdkWindow *window,
|
||||
|
@ -15694,7 +15694,7 @@ gtk_widget_render (GtkWidget *widget,
|
||||
|
||||
gtk_inspector_record_render (widget, renderer, window, region, root);
|
||||
|
||||
context = gdk_window_begin_draw_frame (window, region);
|
||||
context = gdk_window_begin_draw_frame (window, NULL, region);
|
||||
|
||||
gsk_renderer_render (renderer, root, context);
|
||||
gsk_render_node_unref (root);
|
||||
|
Loading…
Reference in New Issue
Block a user