Merge branch 'matthiasc/for-main' into 'main'

gsk: Robustness fix

See merge request GNOME/gtk!6561
This commit is contained in:
Matthias Clasen 2023-11-13 23:36:58 +00:00
commit 6259800f5a
5 changed files with 20 additions and 10 deletions

View File

@ -1104,7 +1104,7 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
(void *) G_STRUCT_OFFSET (GskGLDrawVertex, color2));
/* Setup initial scissor clip */
if (scissor != NULL)
if (scissor != NULL && cairo_region_num_rectangles (scissor) > 0)
{
cairo_rectangle_int_t r;

View File

@ -2822,7 +2822,7 @@ equal_texture_nodes (const GskRenderNode *node1,
gsk_texture_node_get_texture (node2))
return FALSE;
return graphene_rect_equal (&node1->bounds, &node2->bounds);
return gsk_rect_equal (&node1->bounds, &node2->bounds);
}
static inline void
@ -3949,7 +3949,7 @@ gsk_gl_render_job_visit_repeat_node (GskGLRenderJob *job,
if (node_is_invisible (child))
return;
if (!graphene_rect_equal (child_bounds, &child->bounds))
if (!gsk_rect_equal (child_bounds, &child->bounds))
{
/* TODO: implement these repeat nodes. */
gsk_gl_render_job_visit_as_fallback (job, node);

View File

@ -36,3 +36,12 @@ gsk_rect_to_float (const graphene_rect_t *rect,
values[3] = rect->size.height;
}
static inline gboolean
gsk_rect_equal (const graphene_rect_t *r1,
const graphene_rect_t *r2)
{
return r1->origin.x == r2->origin.x &&
r1->origin.y == r2->origin.y &&
r1->size.width == r2->size.width &&
r1->size.height == r2->size.height;
}

View File

@ -131,7 +131,7 @@ gsk_color_node_diff (GskRenderNode *node1,
GskColorNode *self1 = (GskColorNode *) node1;
GskColorNode *self2 = (GskColorNode *) node2;
if (graphene_rect_equal (&node1->bounds, &node2->bounds) &&
if (gsk_rect_equal (&node1->bounds, &node2->bounds) &&
gdk_rgba_equal (&self1->color, &self2->color))
return;
@ -1685,7 +1685,7 @@ gsk_texture_node_diff (GskRenderNode *node1,
GskTextureNode *self2 = (GskTextureNode *) node2;
cairo_region_t *sub;
if (!graphene_rect_equal (&node1->bounds, &node2->bounds) ||
if (!gsk_rect_equal (&node1->bounds, &node2->bounds) ||
gdk_texture_get_width (self1->texture) != gdk_texture_get_width (self2->texture) ||
gdk_texture_get_height (self1->texture) != gdk_texture_get_height (self2->texture))
{
@ -1872,7 +1872,7 @@ gsk_texture_scale_node_diff (GskRenderNode *node1,
GskTextureScaleNode *self2 = (GskTextureScaleNode *) node2;
cairo_region_t *sub;
if (!graphene_rect_equal (&node1->bounds, &node2->bounds) ||
if (!gsk_rect_equal (&node1->bounds, &node2->bounds) ||
self1->filter != self2->filter ||
gdk_texture_get_width (self1->texture) != gdk_texture_get_width (self2->texture) ||
gdk_texture_get_height (self1->texture) != gdk_texture_get_height (self2->texture))
@ -4145,7 +4145,7 @@ gsk_clip_node_diff (GskRenderNode *node1,
GskClipNode *self1 = (GskClipNode *) node1;
GskClipNode *self2 = (GskClipNode *) node2;
if (graphene_rect_equal (&self1->clip, &self2->clip))
if (gsk_rect_equal (&self1->clip, &self2->clip))
{
cairo_region_t *sub;
cairo_rectangle_int_t clip_rect;
@ -6491,7 +6491,7 @@ gsk_gl_shader_node_diff (GskRenderNode *node1,
GskGLShaderNode *self1 = (GskGLShaderNode *) node1;
GskGLShaderNode *self2 = (GskGLShaderNode *) node2;
if (graphene_rect_equal (&node1->bounds, &node2->bounds) &&
if (gsk_rect_equal (&node1->bounds, &node2->bounds) &&
self1->shader == self2->shader &&
g_bytes_compare (self1->args, self2->args) == 0 &&
self1->n_children == self2->n_children)

View File

@ -38,6 +38,7 @@
#include "gdk/gdkhslaprivate.h"
#include "gsk/gskroundedrectprivate.h"
#include "gsk/gskrectprivate.h"
typedef struct _GtkBorderImage GtkBorderImage;
@ -678,8 +679,8 @@ gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
graphene_simd4f_t alpha_test_vector;
/* Optimize the most common case of "This widget has no border" */
if (graphene_rect_equal (gtk_css_boxes_get_border_rect (boxes),
gtk_css_boxes_get_padding_rect (boxes)))
if (gsk_rect_equal (gtk_css_boxes_get_border_rect (boxes),
gtk_css_boxes_get_padding_rect (boxes)))
return;
colors[0] = *gtk_css_color_value_get_rgba (border->border_top_color ? border->border_top_color : boxes->style->core->color);