[libhandy/wip/haecker-felix/flap-widget: 6/8] shadow-helper: Allow drawing shadow with 0 progress




commit 699836163ec0d97c84bb60e164f775ec053af8a8
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 417b3954..f316a028 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]