From 3d3e935c91b997ffa74c839cc0c365961fe81f64 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 4 Aug 2024 22:29:44 -0400 Subject: [PATCH] offload: Use gsk_color_node_get_color2 We want the blackest black. --- gsk/gskoffload.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gsk/gskoffload.c b/gsk/gskoffload.c index d06550cbe9..308274ea9e 100644 --- a/gsk/gskoffload.c +++ b/gsk/gskoffload.c @@ -69,6 +69,15 @@ find_texture_transform (GskTransform *transform) return dihedral; } +static gboolean +color_is_black (const GdkColor *color) +{ + return color->red < 255.f / 65535.f && + color->green < 255.f / 65535.f && + color->blue < 255.f / 65535.f && + color->alpha > 65280.f / 65535.f; +} + static GdkTexture * find_texture_to_attach (GskOffload *self, const GskRenderNode *subsurface_node, @@ -116,7 +125,7 @@ find_texture_to_attach (GskOffload *self, gsk_transform_transform_bounds (transform, &child->bounds, &bounds); if (GSK_RENDER_NODE_TYPE (child) == GSK_COLOR_NODE && gsk_rect_equal (&bounds, &subsurface_node->bounds) && - gdk_rgba_equal (gsk_color_node_get_color (child), &GDK_RGBA_BLACK)) + color_is_black (gsk_color_node_get_color2 (child))) { *has_background = TRUE; node = gsk_container_node_get_child (node, 1);