[libhandy/wip/haecker-felix/flap-widget: 4/6] shadow-helper: Allow drawing shadow with 0 progress
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/haecker-felix/flap-widget: 4/6] shadow-helper: Allow drawing shadow with 0 progress
- Date: Thu, 10 Dec 2020 08:22:55 +0000 (UTC)
commit 95959528d0c94073b398024cf49b793278c9fd44
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Nov 25 15:26:35 2020 +0500
shadow-helper: Allow drawing shadow with 0 progress
For HdyFlap we'll want to draw shadow for opened flap, not just during the
transition. Instead, do the check in HdyStackableBox.
src/hdy-shadow-helper.c | 2 +-
src/hdy-stackable-box.c | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/hdy-shadow-helper.c b/src/hdy-shadow-helper.c
index 14712ecc..cf8ceb09 100644
--- a/src/hdy-shadow-helper.c
+++ b/src/hdy-shadow-helper.c
@@ -339,7 +339,7 @@ hdy_shadow_helper_draw_shadow (HdyShadowHelper *self,
gdouble remaining_distance, shadow_opacity;
gint shadow_size, border_size, outline_size, distance;
- if (progress <= 0 || progress >= 1)
+ if (progress >= 1)
return;
cache_shadow (self, width, height, direction);
diff --git a/src/hdy-stackable-box.c b/src/hdy-stackable-box.c
index de3940b9..9bc522b5 100644
--- a/src/hdy-stackable-box.c
+++ b/src/hdy-stackable-box.c
@@ -2178,12 +2178,14 @@ hdy_stackable_box_draw (HdyStackableBox *self,
cr);
}
- cairo_save (cr);
- cairo_translate (cr, shadow_rect.x, shadow_rect.y);
- hdy_shadow_helper_draw_shadow (self->shadow_helper, cr,
- shadow_rect.width, shadow_rect.height,
- shadow_progress, shadow_direction);
- cairo_restore (cr);
+ if (shadow_progress > 0) {
+ cairo_save (cr);
+ cairo_translate (cr, shadow_rect.x, shadow_rect.y);
+ hdy_shadow_helper_draw_shadow (self->shadow_helper, cr,
+ shadow_rect.width, shadow_rect.height,
+ shadow_progress, shadow_direction);
+ cairo_restore (cr);
+ }
return GDK_EVENT_PROPAGATE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]