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

some small optimizations

See merge request GNOME/gtk!3423
This commit is contained in:
Matthias Clasen 2021-04-11 18:23:54 +00:00
commit 5b55138729
3 changed files with 147 additions and 106 deletions

View File

@ -2,8 +2,8 @@
<interface> <interface>
<object class="GtkWindow" id="window"> <object class="GtkWindow" id="window">
<property name="title" translatable="yes">Help</property> <property name="title" translatable="yes">Help</property>
<property name="default-width">720</property> <property name="default-width">920</property>
<property name="default-height">520</property> <property name="default-height">600</property>
<child> <child>
<object class="GtkScrolledWindow"> <object class="GtkScrolledWindow">
<child> <child>

View File

@ -203,7 +203,7 @@ gsk_rounded_rect_offset (GskRoundedRect *self,
return self; return self;
} }
static void static inline void
border_radius_shrink (graphene_size_t *corner, border_radius_shrink (graphene_size_t *corner,
double width, double width,
double height, double height,
@ -252,26 +252,29 @@ gsk_rounded_rect_shrink (GskRoundedRect *self,
float bottom, float bottom,
float left) float left)
{ {
if (self->bounds.size.width - left - right < 0) float width = left + right;
float height = top + bottom;
if (self->bounds.size.width - width < 0)
{ {
self->bounds.origin.x += left * self->bounds.size.width / (left + right); self->bounds.origin.x += left * self->bounds.size.width / width;
self->bounds.size.width = 0; self->bounds.size.width = 0;
} }
else else
{ {
self->bounds.origin.x += left; self->bounds.origin.x += left;
self->bounds.size.width -= left + right; self->bounds.size.width -= width;
} }
if (self->bounds.size.height - bottom - top < 0) if (self->bounds.size.height - height < 0)
{ {
self->bounds.origin.y += top * self->bounds.size.height / (top + bottom); self->bounds.origin.y += top * self->bounds.size.height / height;
self->bounds.size.height = 0; self->bounds.size.height = 0;
} }
else else
{ {
self->bounds.origin.y += top; self->bounds.origin.y += top;
self->bounds.size.height -= top + bottom; self->bounds.size.height -= height;
} }
border_radius_shrink (&self->corner[GSK_CORNER_TOP_LEFT], left, top, &self->bounds.size); border_radius_shrink (&self->corner[GSK_CORNER_TOP_LEFT], left, top, &self->bounds.size);
@ -311,9 +314,7 @@ gsk_rounded_rect_scale_affine (GskRoundedRect *dest,
gboolean gboolean
gsk_rounded_rect_is_circular (const GskRoundedRect *self) gsk_rounded_rect_is_circular (const GskRoundedRect *self)
{ {
guint i; for (guint i = 0; i < 4; i++)
for (i = 0; i < 4; i++)
{ {
if (self->corner[i].width != self->corner[i].height) if (self->corner[i].width != self->corner[i].height)
return FALSE; return FALSE;
@ -337,9 +338,7 @@ gsk_rounded_rect_is_circular (const GskRoundedRect *self)
gboolean gboolean
gsk_rounded_rect_is_rectilinear (const GskRoundedRect *self) gsk_rounded_rect_is_rectilinear (const GskRoundedRect *self)
{ {
guint i; for (guint i = 0; i < 4; i++)
for (i = 0; i < 4; i++)
{ {
if (self->corner[i].width > 0 || if (self->corner[i].width > 0 ||
self->corner[i].height > 0) self->corner[i].height > 0)
@ -349,8 +348,8 @@ gsk_rounded_rect_is_rectilinear (const GskRoundedRect *self)
return TRUE; return TRUE;
} }
static gboolean static inline gboolean
ellipsis_contains_point (const graphene_size_t *ellipsis, ellipsis_contains_point (const graphene_size_t *ellipsis,
const graphene_point_t *point) const graphene_point_t *point)
{ {
return (point->x * point->x) / (ellipsis->width * ellipsis->width) return (point->x * point->x) / (ellipsis->width * ellipsis->width)
@ -371,46 +370,42 @@ static Location
gsk_rounded_rect_locate_point (const GskRoundedRect *self, gsk_rounded_rect_locate_point (const GskRoundedRect *self,
const graphene_point_t *point) const graphene_point_t *point)
{ {
float px, py;
float ox, oy;
ox = self->bounds.origin.x + self->bounds.size.width;
oy = self->bounds.origin.y + self->bounds.size.height;
if (point->x < self->bounds.origin.x || if (point->x < self->bounds.origin.x ||
point->y < self->bounds.origin.y || point->y < self->bounds.origin.y ||
point->x > self->bounds.origin.x + self->bounds.size.width || point->x > ox ||
point->y > self->bounds.origin.y + self->bounds.size.height) point->y > oy)
return OUTSIDE; return OUTSIDE;
if (self->bounds.origin.x + self->corner[GSK_CORNER_TOP_LEFT].width > point->x && px = self->bounds.origin.x + self->corner[GSK_CORNER_TOP_LEFT].width - point->x;
self->bounds.origin.y + self->corner[GSK_CORNER_TOP_LEFT].height > point->y && py = self->bounds.origin.y + self->corner[GSK_CORNER_TOP_LEFT].height - point->y;
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_LEFT], if (px > 0 && py > 0 &&
&GRAPHENE_POINT_INIT ( !ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_LEFT], &GRAPHENE_POINT_INIT (px, py)))
self->bounds.origin.x + self->corner[GSK_CORNER_TOP_LEFT].width - point->x,
self->bounds.origin.y + self->corner[GSK_CORNER_TOP_LEFT].height- point->y
)))
return OUTSIDE_TOP_LEFT; return OUTSIDE_TOP_LEFT;
if (self->bounds.origin.x + self->bounds.size.width - self->corner[GSK_CORNER_TOP_RIGHT].width < point->x && px = ox - self->corner[GSK_CORNER_TOP_RIGHT].width - point->x;
self->bounds.origin.y + self->corner[GSK_CORNER_TOP_RIGHT].height > point->y && py = self->bounds.origin.y + self->corner[GSK_CORNER_TOP_RIGHT].height - point->y;
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_RIGHT], if (px < 0 && py > 0 &&
&GRAPHENE_POINT_INIT ( !ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_RIGHT], &GRAPHENE_POINT_INIT (px, py)))
self->bounds.origin.x + self->bounds.size.width - self->corner[GSK_CORNER_TOP_RIGHT].width - point->x,
self->bounds.origin.y + self->corner[GSK_CORNER_TOP_RIGHT].height- point->y
)))
return OUTSIDE_TOP_RIGHT; return OUTSIDE_TOP_RIGHT;
if (self->bounds.origin.x + self->corner[GSK_CORNER_BOTTOM_LEFT].width > point->x && px = self->bounds.origin.x + self->corner[GSK_CORNER_BOTTOM_LEFT].width - point->x;
self->bounds.origin.y + self->bounds.size.height - self->corner[GSK_CORNER_BOTTOM_LEFT].height < point->y && py = oy - self->corner[GSK_CORNER_BOTTOM_LEFT].height - point->y;
if (px > 0 && py < 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_LEFT], !ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_LEFT],
&GRAPHENE_POINT_INIT ( &GRAPHENE_POINT_INIT (px, py)))
self->bounds.origin.x + self->corner[GSK_CORNER_BOTTOM_LEFT].width - point->x,
self->bounds.origin.y + self->bounds.size.height - self->corner[GSK_CORNER_BOTTOM_LEFT].height- point->y
)))
return OUTSIDE_BOTTOM_LEFT; return OUTSIDE_BOTTOM_LEFT;
if (self->bounds.origin.x + self->bounds.size.width - self->corner[GSK_CORNER_BOTTOM_RIGHT].width < point->x && px = ox - self->corner[GSK_CORNER_BOTTOM_RIGHT].width - point->x;
self->bounds.origin.y + self->bounds.size.height - self->corner[GSK_CORNER_BOTTOM_RIGHT].height < point->y && py = oy - self->corner[GSK_CORNER_BOTTOM_RIGHT].height - point->y;
if (px < 0 && py < 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_RIGHT], !ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_RIGHT],
&GRAPHENE_POINT_INIT ( &GRAPHENE_POINT_INIT (px, py)))
self->bounds.origin.x + self->bounds.size.width - self->corner[GSK_CORNER_BOTTOM_RIGHT].width - point->x,
self->bounds.origin.y + self->bounds.size.height - self->corner[GSK_CORNER_BOTTOM_RIGHT].height- point->y
)))
return OUTSIDE_BOTTOM_RIGHT; return OUTSIDE_BOTTOM_RIGHT;
return INSIDE; return INSIDE;
@ -445,16 +440,45 @@ gboolean
gsk_rounded_rect_contains_rect (const GskRoundedRect *self, gsk_rounded_rect_contains_rect (const GskRoundedRect *self,
const graphene_rect_t *rect) const graphene_rect_t *rect)
{ {
float tx, ty;
float px, py;
float ox, oy;
tx = rect->origin.x + rect->size.width;
ty = rect->origin.y + rect->size.height;
ox = self->bounds.origin.x + self->bounds.size.width;
oy = self->bounds.origin.y + self->bounds.size.height;
if (rect->origin.x < self->bounds.origin.x || if (rect->origin.x < self->bounds.origin.x ||
rect->origin.y < self->bounds.origin.y || rect->origin.y < self->bounds.origin.y ||
rect->origin.x + rect->size.width > self->bounds.origin.x + self->bounds.size.width || tx > ox ||
rect->origin.y + rect->size.height > self->bounds.origin.y + self->bounds.size.height) ty > oy)
return FALSE; return FALSE;
if (!gsk_rounded_rect_contains_point (self, &rect->origin) || px = self->bounds.origin.x + self->corner[GSK_CORNER_TOP_LEFT].width - rect->origin.x;
!gsk_rounded_rect_contains_point (self, &GRAPHENE_POINT_INIT (rect->origin.x + rect->size.width, rect->origin.y)) || py = self->bounds.origin.y + self->corner[GSK_CORNER_TOP_LEFT].height - rect->origin.y;
!gsk_rounded_rect_contains_point (self, &GRAPHENE_POINT_INIT (rect->origin.x, rect->origin.y + rect->size.height)) || if (px > 0 && py > 0 &&
!gsk_rounded_rect_contains_point (self, &GRAPHENE_POINT_INIT (rect->origin.x + rect->size.width, rect->origin.y + rect->size.height))) !ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_LEFT], &GRAPHENE_POINT_INIT (px, py)))
return FALSE;
px = ox - self->corner[GSK_CORNER_TOP_RIGHT].width - tx;
py = self->bounds.origin.y + self->corner[GSK_CORNER_TOP_RIGHT].height - rect->origin.y;
if (px < 0 && py > 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_RIGHT], &GRAPHENE_POINT_INIT (px, py)))
return FALSE;
px = self->bounds.origin.x + self->corner[GSK_CORNER_BOTTOM_LEFT].width - rect->origin.x;
py = oy - self->corner[GSK_CORNER_BOTTOM_LEFT].height - ty;
if (px > 0 && py < 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_LEFT],
&GRAPHENE_POINT_INIT (px, py)))
return FALSE;
px = ox - self->corner[GSK_CORNER_BOTTOM_RIGHT].width - tx;
py = oy - self->corner[GSK_CORNER_BOTTOM_RIGHT].height - ty;
if (px < 0 && py < 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_RIGHT],
&GRAPHENE_POINT_INIT (px, py)))
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -476,8 +500,10 @@ gsk_rounded_rect_intersects_rect (const GskRoundedRect *self,
if (!graphene_rect_intersection (&self->bounds, rect, NULL)) if (!graphene_rect_intersection (&self->bounds, rect, NULL))
return FALSE; return FALSE;
/* If the bounding boxes intersect but the rectangles don't, one of the rect's corners /* If the bounding boxes intersect but the rectangles don't,
* must be in the opposite corner's outside region */ * one of the rect's corners must be in the opposite corner's
* outside region
*/
if (gsk_rounded_rect_locate_point (self, &rect->origin) == OUTSIDE_BOTTOM_RIGHT || if (gsk_rounded_rect_locate_point (self, &rect->origin) == OUTSIDE_BOTTOM_RIGHT ||
gsk_rounded_rect_locate_point (self, &GRAPHENE_POINT_INIT (rect->origin.x + rect->size.width, rect->origin.y)) == OUTSIDE_BOTTOM_LEFT || gsk_rounded_rect_locate_point (self, &GRAPHENE_POINT_INIT (rect->origin.x + rect->size.width, rect->origin.y)) == OUTSIDE_BOTTOM_LEFT ||
gsk_rounded_rect_locate_point (self, &GRAPHENE_POINT_INIT (rect->origin.x, rect->origin.y + rect->size.height)) == OUTSIDE_TOP_RIGHT || gsk_rounded_rect_locate_point (self, &GRAPHENE_POINT_INIT (rect->origin.x, rect->origin.y + rect->size.height)) == OUTSIDE_TOP_RIGHT ||

View File

@ -212,6 +212,13 @@ node_is_invisible (const GskRenderNode *node)
node->bounds.size.height == 0.0f; node->bounds.size.height == 0.0f;
} }
static inline gboolean G_GNUC_PURE
rounded_rect_equal (const GskRoundedRect *r1,
const GskRoundedRect *r2)
{
return memcmp (r1, r2, sizeof (GskRoundedRect)) == 0;
}
static inline void static inline void
gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self) gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self)
{ {
@ -811,9 +818,9 @@ interval_contains (float p1, float w1,
} }
static inline gboolean static inline gboolean
gsk_ngl_render_job_update_clip (GskNglRenderJob *job, gsk_ngl_render_job_update_clip (GskNglRenderJob *job,
const GskRenderNode *node, const graphene_rect_t *bounds,
gboolean *pushed_clip) gboolean *pushed_clip)
{ {
graphene_rect_t transformed_bounds; graphene_rect_t transformed_bounds;
gboolean no_clip = FALSE; gboolean no_clip = FALSE;
@ -827,7 +834,7 @@ gsk_ngl_render_job_update_clip (GskNglRenderJob *job,
return TRUE; return TRUE;
} }
gsk_ngl_render_job_transform_bounds (job, &node->bounds, &transformed_bounds); gsk_ngl_render_job_transform_bounds (job, bounds, &transformed_bounds);
if (!rect_intersects (&job->current_clip->rect.bounds, &transformed_bounds)) if (!rect_intersects (&job->current_clip->rect.bounds, &transformed_bounds))
{ {
@ -2451,6 +2458,8 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
return; return;
} }
/* slicing */
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, outset_shadow)); gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, outset_shadow));
gsk_ngl_program_set_uniform_texture (job->current_program, gsk_ngl_program_set_uniform_texture (job->current_program,
UNIFORM_SHARED_SOURCE, 0, UNIFORM_SHARED_SOURCE, 0,
@ -2469,6 +2478,8 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
float max_y = ceilf (outline->bounds.origin.y + outline->bounds.size.height + float max_y = ceilf (outline->bounds.origin.y + outline->bounds.size.height +
half_blur_extra + dy + spread); half_blur_extra + dy + spread);
const GskNglTextureNineSlice *slices; const GskNglTextureNineSlice *slices;
float left_width, center_width, right_width;
float top_height, center_height, bottom_height;
GskNglTexture *texture; GskNglTexture *texture;
texture = gsk_ngl_driver_get_texture_by_id (job->driver, blurred_texture_id); texture = gsk_ngl_driver_get_texture_by_id (job->driver, blurred_texture_id);
@ -2479,14 +2490,23 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
/* Our texture coordinates MUST be scaled, while the actual vertex coords /* Our texture coordinates MUST be scaled, while the actual vertex coords
* MUST NOT be scaled. */ * MUST NOT be scaled. */
left_width = slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x;
right_width = slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x;
center_width = (max_x - min_x) - (left_width + right_width);
top_height = slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y;
bottom_height = slices[NINE_SLICE_BOTTOM_LEFT].rect.height / scale_y;
center_height = (max_y - min_y) - (top_height + bottom_height);
/* Top left */ /* Top left */
if (nine_slice_is_visible (&slices[NINE_SLICE_TOP_LEFT])) if (nine_slice_is_visible (&slices[NINE_SLICE_TOP_LEFT]))
{ {
memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_LEFT].area, sizeof offscreen.area); memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_LEFT].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job, gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x, min_y, &GRAPHENE_RECT_INIT (min_x,
slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x, min_y,
slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y), left_width,
top_height),
&offscreen, &offscreen,
color); color);
} }
@ -2495,13 +2515,11 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
if (nine_slice_is_visible (&slices[NINE_SLICE_TOP_CENTER])) if (nine_slice_is_visible (&slices[NINE_SLICE_TOP_CENTER]))
{ {
memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_CENTER].area, sizeof offscreen.area); memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_CENTER].area, sizeof offscreen.area);
float width = (max_x - min_x) - (slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x +
slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x);
gsk_ngl_render_job_draw_offscreen_with_color (job, gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x + (slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x), &GRAPHENE_RECT_INIT (min_x + left_width,
min_y, min_y,
width, center_width,
slices[NINE_SLICE_TOP_CENTER].rect.height / scale_y), top_height),
&offscreen, &offscreen,
color); color);
} }
@ -2511,10 +2529,10 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
{ {
memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_RIGHT].area, sizeof offscreen.area); memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_RIGHT].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job, gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (max_x - (slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x), &GRAPHENE_RECT_INIT (max_x - right_width,
min_y, min_y,
slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x, right_width,
slices[NINE_SLICE_TOP_RIGHT].rect.height / scale_y), top_height),
&offscreen, &offscreen,
color); color);
} }
@ -2524,10 +2542,10 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
{ {
memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_RIGHT].area, sizeof offscreen.area); memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_RIGHT].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job, gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (max_x - (slices[NINE_SLICE_BOTTOM_RIGHT].rect.width / scale_x), &GRAPHENE_RECT_INIT (max_x - right_width,
max_y - (slices[NINE_SLICE_BOTTOM_RIGHT].rect.height / scale_y), max_y - bottom_height,
slices[NINE_SLICE_BOTTOM_RIGHT].rect.width / scale_x, right_width,
slices[NINE_SLICE_BOTTOM_RIGHT].rect.height / scale_y), bottom_height),
&offscreen, &offscreen,
color); color);
} }
@ -2538,9 +2556,9 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_LEFT].area, sizeof offscreen.area); memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_LEFT].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job, gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x, &GRAPHENE_RECT_INIT (min_x,
max_y - (slices[NINE_SLICE_BOTTOM_LEFT].rect.height / scale_y), max_y - bottom_height,
slices[NINE_SLICE_BOTTOM_LEFT].rect.width / scale_x, left_width,
slices[NINE_SLICE_BOTTOM_LEFT].rect.height / scale_y), bottom_height),
&offscreen, &offscreen,
color); color);
} }
@ -2549,13 +2567,11 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
if (nine_slice_is_visible (&slices[NINE_SLICE_LEFT_CENTER])) if (nine_slice_is_visible (&slices[NINE_SLICE_LEFT_CENTER]))
{ {
memcpy (&offscreen.area, &slices[NINE_SLICE_LEFT_CENTER].area, sizeof offscreen.area); memcpy (&offscreen.area, &slices[NINE_SLICE_LEFT_CENTER].area, sizeof offscreen.area);
float height = (max_y - min_y) - (slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y +
slices[NINE_SLICE_BOTTOM_LEFT].rect.height / scale_y);
gsk_ngl_render_job_draw_offscreen_with_color (job, gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x, &GRAPHENE_RECT_INIT (min_x,
min_y + (slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y), min_y + top_height,
slices[NINE_SLICE_LEFT_CENTER].rect.width / scale_x, left_width,
height), center_height),
&offscreen, &offscreen,
color); color);
} }
@ -2564,13 +2580,11 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
if (nine_slice_is_visible (&slices[NINE_SLICE_RIGHT_CENTER])) if (nine_slice_is_visible (&slices[NINE_SLICE_RIGHT_CENTER]))
{ {
memcpy (&offscreen.area, &slices[NINE_SLICE_RIGHT_CENTER].area, sizeof offscreen.area); memcpy (&offscreen.area, &slices[NINE_SLICE_RIGHT_CENTER].area, sizeof offscreen.area);
float height = (max_y - min_y) - (slices[NINE_SLICE_TOP_RIGHT].rect.height / scale_y +
slices[NINE_SLICE_BOTTOM_RIGHT].rect.height / scale_y);
gsk_ngl_render_job_draw_offscreen_with_color (job, gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (max_x - (slices[NINE_SLICE_RIGHT_CENTER].rect.width / scale_x), &GRAPHENE_RECT_INIT (max_x - right_width,
min_y + (slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y), min_y + top_height,
slices[NINE_SLICE_RIGHT_CENTER].rect.width / scale_x, right_width,
height), center_height),
&offscreen, &offscreen,
color); color);
} }
@ -2579,13 +2593,11 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
if (nine_slice_is_visible (&slices[NINE_SLICE_BOTTOM_CENTER])) if (nine_slice_is_visible (&slices[NINE_SLICE_BOTTOM_CENTER]))
{ {
memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_CENTER].area, sizeof offscreen.area); memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_CENTER].area, sizeof offscreen.area);
float width = (max_x - min_x) - (slices[NINE_SLICE_BOTTOM_LEFT].rect.width / scale_x +
slices[NINE_SLICE_BOTTOM_RIGHT].rect.width / scale_x);
gsk_ngl_render_job_draw_offscreen_with_color (job, gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x + (slices[NINE_SLICE_BOTTOM_LEFT].rect.width / scale_x), &GRAPHENE_RECT_INIT (min_x + left_width,
max_y - (slices[NINE_SLICE_BOTTOM_CENTER].rect.height / scale_y), max_y - bottom_height,
width, center_width,
slices[NINE_SLICE_BOTTOM_CENTER].rect.height / scale_y), bottom_height),
&offscreen, &offscreen,
color); color);
} }
@ -2593,17 +2605,20 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
/* Middle */ /* Middle */
if (nine_slice_is_visible (&slices[NINE_SLICE_CENTER])) if (nine_slice_is_visible (&slices[NINE_SLICE_CENTER]))
{ {
memcpy (&offscreen.area, &slices[NINE_SLICE_CENTER].area, sizeof offscreen.area); if (!gsk_rounded_rect_contains_rect (outline, &GRAPHENE_RECT_INIT (min_x + left_width,
float width = (max_x - min_x) - (slices[NINE_SLICE_LEFT_CENTER].rect.width / scale_x + min_y + top_height,
slices[NINE_SLICE_RIGHT_CENTER].rect.width / scale_x); center_width,
float height = (max_y - min_y) - (slices[NINE_SLICE_TOP_CENTER].rect.height / scale_y + center_height)))
slices[NINE_SLICE_BOTTOM_CENTER].rect.height / scale_y); {
gsk_ngl_render_job_draw_offscreen_with_color (job, memcpy (&offscreen.area, &slices[NINE_SLICE_CENTER].area, sizeof offscreen.area);
&GRAPHENE_RECT_INIT (min_x + (slices[NINE_SLICE_LEFT_CENTER].rect.width / scale_x), gsk_ngl_render_job_draw_offscreen_with_color (job,
min_y + (slices[NINE_SLICE_TOP_CENTER].rect.height / scale_y), &GRAPHENE_RECT_INIT (min_x + left_width,
width, height), min_y + top_height,
&offscreen, center_width,
color); center_height),
&offscreen,
color);
}
} }
} }
@ -3414,7 +3429,7 @@ gsk_ngl_render_job_visit_node (GskNglRenderJob *job,
if (node_is_invisible (node)) if (node_is_invisible (node))
return; return;
if (!gsk_ngl_render_job_update_clip (job, node, &has_clip)) if (!gsk_ngl_render_job_update_clip (job, &node->bounds, &has_clip))
return; return;
switch (gsk_render_node_get_node_type (node)) switch (gsk_render_node_get_node_type (node))
@ -3474,8 +3489,8 @@ gsk_ngl_render_job_visit_node (GskNglRenderJob *job,
if (gsk_render_node_get_node_type (grandchild) == GSK_COLOR_NODE && if (gsk_render_node_get_node_type (grandchild) == GSK_COLOR_NODE &&
gsk_render_node_get_node_type (child2) == GSK_BORDER_NODE && gsk_render_node_get_node_type (child2) == GSK_BORDER_NODE &&
gsk_border_node_get_uniform_color (child2) && gsk_border_node_get_uniform_color (child2) &&
gsk_rounded_rect_equal (gsk_rounded_clip_node_get_clip (child), rounded_rect_equal (gsk_rounded_clip_node_get_clip (child),
gsk_border_node_get_outline (child2))) gsk_border_node_get_outline (child2)))
{ {
gsk_ngl_render_job_visit_css_background (job, child, child2); gsk_ngl_render_job_visit_css_background (job, child, child2);
i++; /* skip the border node */ i++; /* skip the border node */