[gtk] gl renderer: Only add outset shadow center piece if dx/dy != 0



commit a29826bb71042c543cceb7f4ba48fb754c9e8671
Author: Timm Bäder <mail baedert org>
Date:   Fri Oct 11 08:46:33 2019 +0200

    gl renderer: Only add outset shadow center piece if dx/dy != 0

 gsk/gl/gskglrenderer.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 3835aaa2bb..3dbb0b67d1 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -1747,26 +1747,29 @@ render_outset_shadow_node (GskGLRenderer       *self,
         });
       }
 
-    /* Middle */
-    x1 = min_x + dx + left_width;
-    x2 = max_x + dx - right_width;
-    y1 = min_y + dy + top_height;
-    y2 = max_y + dy - bottom_height;
-    if (x2 > x1 && y2 > y1)
+    if (dx != 0 || dy != 0)
       {
-        tx1 = (texture_width - SHADOW_EXTRA_SIZE)  / 2.0f / texture_width;
-        tx2 = (texture_width + SHADOW_EXTRA_SIZE)  / 2.0f / texture_width;
-        ty1 = (texture_height - SHADOW_EXTRA_SIZE) / 2.0f / texture_height;
-        ty2 = (texture_height + SHADOW_EXTRA_SIZE) / 2.0f / texture_height;
-        ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
-          { { x1, y1 }, { tx1, ty2 }, },
-          { { x1, y2 }, { tx1, ty1 }, },
-          { { x2, y1 }, { tx2, ty2 }, },
-
-          { { x2, y2 }, { tx2, ty1 }, },
-          { { x1, y2 }, { tx1, ty1 }, },
-          { { x2, y1 }, { tx2, ty2 }, },
-        });
+        /* Middle */
+        x1 = min_x + dx + left_width;
+        x2 = max_x + dx - right_width;
+        y1 = min_y + dy + top_height;
+        y2 = max_y + dy - bottom_height;
+        if (x2 > x1 && y2 > y1)
+          {
+            tx1 = (texture_width - SHADOW_EXTRA_SIZE)  / 2.0f / texture_width;
+            tx2 = (texture_width + SHADOW_EXTRA_SIZE)  / 2.0f / texture_width;
+            ty1 = (texture_height - SHADOW_EXTRA_SIZE) / 2.0f / texture_height;
+            ty2 = (texture_height + SHADOW_EXTRA_SIZE) / 2.0f / texture_height;
+            ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
+              { { x1, y1 }, { tx1, ty2 }, },
+              { { x1, y2 }, { tx1, ty1 }, },
+              { { x2, y1 }, { tx2, ty2 }, },
+
+              { { x2, y2 }, { tx2, ty1 }, },
+              { { x1, y2 }, { tx1, ty1 }, },
+              { { x2, y1 }, { tx2, ty2 }, },
+            });
+          }
       }
 
   }


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