[libhandy] shadow-helper: Fix outline offset in some directions



commit af3b6992820919b3199781b517022fecd9d6b2a1
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu Jun 25 18:14:40 2020 +0500

    shadow-helper: Fix outline offset in some directions
    
    While it's correct to translate by the border size when we're drawing
    outline to the right of it, we need to instead translate by the outline
    size if we're drawing outline to the left of it.
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org>

 src/hdy-shadow-helper.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/hdy-shadow-helper.c b/src/hdy-shadow-helper.c
index fef184d0..ee4272ae 100644
--- a/src/hdy-shadow-helper.c
+++ b/src/hdy-shadow-helper.c
@@ -334,7 +334,7 @@ hdy_shadow_helper_draw_shadow (HdyShadowHelper *self,
                                GtkPanDirection  direction)
 {
   gdouble remaining_distance, shadow_opacity;
-  gint shadow_size, border_size, distance;
+  gint shadow_size, border_size, outline_size, distance;
 
   if (progress <= 0 || progress >= 1)
     return;
@@ -343,6 +343,7 @@ hdy_shadow_helper_draw_shadow (HdyShadowHelper *self,
 
   shadow_size = self->shadow_size;
   border_size = self->border_size;
+  outline_size = self->outline_size;
 
   switch (direction) {
   case GTK_PAN_DIRECTION_LEFT:
@@ -418,10 +419,10 @@ hdy_shadow_helper_draw_shadow (HdyShadowHelper *self,
     cairo_translate (cr, 0, border_size);
     break;
   case GTK_PAN_DIRECTION_LEFT:
-    cairo_translate (cr, -border_size, 0);
+    cairo_translate (cr, -outline_size, 0);
     break;
   case GTK_PAN_DIRECTION_UP:
-    cairo_translate (cr, 0, -border_size);
+    cairo_translate (cr, 0, -outline_size);
     break;
   default:
     g_assert_not_reached ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]