Merge branch 'wip/otte/for-main' into 'main'

gltexture: Restore previous GL context

See merge request GNOME/gtk!6335
This commit is contained in:
Benjamin Otte 2023-08-25 21:44:17 +00:00
commit 81821978ae
4 changed files with 29 additions and 8 deletions

View File

@ -95,10 +95,11 @@ static gboolean
gdk_gl_texture_invoke_callback (gpointer data)
{
InvokeData *invoke = data;
GdkGLContext *context;
GdkGLContext *context, *previous;
context = gdk_display_get_gl_context (gdk_gl_context_get_display (invoke->self->context));
previous = gdk_gl_context_get_current ();
gdk_gl_context_make_current (context);
if (invoke->self->sync && context != invoke->self->context)
@ -110,6 +111,11 @@ gdk_gl_texture_invoke_callback (gpointer data)
g_atomic_int_set (&invoke->spinlock, 1);
if (previous)
gdk_gl_context_make_current (previous);
else
gdk_gl_context_clear_current ();
return FALSE;
}

View File

@ -1172,10 +1172,16 @@ create_default_texture (void)
return texture;
}
static GskRenderNode *
create_default_render_node_with_bounds (const graphene_rect_t *rect)
{
return gsk_color_node_new (&GDK_RGBA("FF00CC"), rect);
}
static GskRenderNode *
create_default_render_node (void)
{
return gsk_color_node_new (&GDK_RGBA("FF00CC"), &GRAPHENE_RECT_INIT (0, 0, 50, 50));
return create_default_render_node_with_bounds (&GRAPHENE_RECT_INIT (0, 0, 50, 50));
}
static GskPath *
@ -2254,10 +2260,14 @@ parse_fill_node (GtkCssParser *parser,
GskRenderNode *result;
parse_declarations (parser, context, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
if (path == NULL)
path = create_default_path ();
if (child == NULL)
{
graphene_rect_t bounds;
gsk_path_get_bounds (path, &bounds);
child = create_default_render_node_with_bounds (&bounds);
}
result = gsk_fill_node_new (child, path, rule);
@ -2311,8 +2321,6 @@ parse_stroke_node (GtkCssParser *parser,
GskRenderNode *result;
parse_declarations (parser, context, declarations, G_N_ELEMENTS (declarations));
if (child == NULL)
child = create_default_render_node ();
if (path == NULL)
path = create_default_path ();
@ -2327,6 +2335,13 @@ parse_stroke_node (GtkCssParser *parser,
}
gsk_stroke_set_dash_offset (stroke, dash_offset);
if (child == NULL)
{
graphene_rect_t bounds;
gsk_path_get_stroke_bounds (path, stroke, &bounds);
child = create_default_render_node_with_bounds (&bounds);
}
result = gsk_stroke_node_new (child, path, stroke);
gsk_path_unref (path);

View File

@ -1,6 +1,6 @@
fill {
child: color {
bounds: 0 0 50 50;
bounds: 1.22359 0 47.5528 45.2254;
color: rgb(255,0,204);
}
path: "\

View File

@ -1,6 +1,6 @@
stroke {
child: color {
bounds: 0 0 50 50;
bounds: -2.77641 -4 55.5528 53.2254;
color: rgb(255,0,204);
}
path: "\