[gtk/gtk-4-2: 24/91] gsk: Don't overshadow
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-4-2: 24/91] gsk: Don't overshadow
- Date: Tue, 4 May 2021 02:05:40 +0000 (UTC)
commit 3852512446a104b106a76b0c1983547a4be6cde9
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Apr 8 09:36:51 2021 -0400
gsk: Don't overshadow
Reduce the cairo shadows to the same size as their GL brethren.
gsk/gskrendernodeimpl.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index 640c792268..49149d4c2d 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -1867,6 +1867,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
GskRoundedRect box, clip_box;
int clip_radius;
double x1c, y1c, x2c, y2c;
+ double blur_radius;
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (&self->color))
@@ -1876,7 +1877,9 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
if (!gsk_rounded_rect_intersects_rect (&self->outline, &GRAPHENE_RECT_INIT (x1c, y1c, x2c - x1c, y2c -
y1c)))
return;
- clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius);
+ blur_radius = self->blur_radius / 2;
+
+ clip_radius = gsk_cairo_blur_compute_pixels (blur_radius);
cairo_save (cr);
@@ -1890,8 +1893,8 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
gsk_rounded_rect_init_copy (&clip_box, &self->outline);
gsk_rounded_rect_shrink (&clip_box, -clip_radius, -clip_radius, -clip_radius, -clip_radius);
- if (!needs_blur (self->blur_radius))
- draw_shadow (cr, TRUE, &box, &clip_box, self->blur_radius, &self->color, GSK_BLUR_NONE);
+ if (!needs_blur (blur_radius))
+ draw_shadow (cr, TRUE, &box, &clip_box, blur_radius, &self->color, GSK_BLUR_NONE);
else
{
cairo_region_t *remaining;
@@ -1922,7 +1925,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
/* Always clip with remaining to ensure we never draw any area twice */
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
- draw_shadow_corner (cr, TRUE, &box, &clip_box, self->blur_radius, &self->color, i, &r);
+ draw_shadow_corner (cr, TRUE, &box, &clip_box, blur_radius, &self->color, i, &r);
cairo_restore (cr);
/* We drew the region, remove it from remaining */
@@ -1936,7 +1939,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
/* Always clip with remaining to ensure we never draw any area twice */
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
- draw_shadow_side (cr, TRUE, &box, &clip_box, self->blur_radius, &self->color, i, &r);
+ draw_shadow_side (cr, TRUE, &box, &clip_box, blur_radius, &self->color, i, &r);
cairo_restore (cr);
/* We drew the region, remove it from remaining */
@@ -1948,7 +1951,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
cairo_save (cr);
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
- draw_shadow (cr, TRUE, &box, &clip_box, self->blur_radius, &self->color, GSK_BLUR_NONE);
+ draw_shadow (cr, TRUE, &box, &clip_box, blur_radius, &self->color, GSK_BLUR_NONE);
cairo_restore (cr);
cairo_region_destroy (remaining);
@@ -2159,6 +2162,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
int clip_radius;
double x1c, y1c, x2c, y2c;
float top, right, bottom, left;
+ double blur_radius;
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (&self->color))
@@ -2168,7 +2172,9 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
if (gsk_rounded_rect_contains_rect (&self->outline, &GRAPHENE_RECT_INIT (x1c, y1c, x2c - x1c, y2c - y1c)))
return;
- clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius);
+ blur_radius = self->blur_radius / 2;
+
+ clip_radius = gsk_cairo_blur_compute_pixels (blur_radius);
cairo_save (cr);
@@ -2186,8 +2192,8 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
gsk_rounded_rect_offset (&box, self->dx, self->dy);
gsk_rounded_rect_shrink (&box, -self->spread, -self->spread, -self->spread, -self->spread);
- if (!needs_blur (self->blur_radius))
- draw_shadow (cr, FALSE, &box, &clip_box, self->blur_radius, &self->color, GSK_BLUR_NONE);
+ if (!needs_blur (blur_radius))
+ draw_shadow (cr, FALSE, &box, &clip_box, blur_radius, &self->color, GSK_BLUR_NONE);
else
{
int i;
@@ -2217,7 +2223,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
/* Always clip with remaining to ensure we never draw any area twice */
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
- draw_shadow_corner (cr, FALSE, &box, &clip_box, self->blur_radius, &self->color, i, &r);
+ draw_shadow_corner (cr, FALSE, &box, &clip_box, blur_radius, &self->color, i, &r);
cairo_restore (cr);
/* We drew the region, remove it from remaining */
@@ -2231,7 +2237,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
/* Always clip with remaining to ensure we never draw any area twice */
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
- draw_shadow_side (cr, FALSE, &box, &clip_box, self->blur_radius, &self->color, i, &r);
+ draw_shadow_side (cr, FALSE, &box, &clip_box, blur_radius, &self->color, i, &r);
cairo_restore (cr);
/* We drew the region, remove it from remaining */
@@ -2243,7 +2249,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
cairo_save (cr);
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
- draw_shadow (cr, FALSE, &box, &clip_box, self->blur_radius, &self->color, GSK_BLUR_NONE);
+ draw_shadow (cr, FALSE, &box, &clip_box, blur_radius, &self->color, GSK_BLUR_NONE);
cairo_restore (cr);
cairo_region_destroy (remaining);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]