[gtk/modern-testsuite: 18/23] ngl: Improve shortcuts for shadow nodes




commit 9e14de25345039318bdd0a1f980139381bfae188
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Sep 16 08:04:09 2021 -0400

    ngl: Improve shortcuts for shadow nodes
    
    For shadow nodes, we try pretty hard to avoid
    rendering shadows, and and we have a shortcut
    that just renders text offset, but we can try
    harder to do nothing - if the text is offset
    by zero, we don't need to draw it at all.

 gsk/ngl/gsknglrenderjob.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index 63da37b643..92d659f976 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -3055,21 +3055,24 @@ gsk_ngl_render_job_visit_shadow_node (GskNglRenderJob     *job,
       graphene_rect_t bounds;
       guint16 color[4];
 
-      if (shadow->radius == 0 &&
-          gsk_render_node_get_node_type (shadow_child) == GSK_TEXT_NODE)
-        {
-          gsk_ngl_render_job_offset (job, dx, dy);
-          gsk_ngl_render_job_visit_text_node (job, shadow_child, &shadow->color, TRUE);
-          gsk_ngl_render_job_offset (job, -dx, -dy);
-          continue;
-        }
-
       if (RGBA_IS_CLEAR (&shadow->color))
         continue;
 
       if (node_is_invisible (shadow_child))
         continue;
 
+      if (shadow->radius == 0 &&
+          gsk_render_node_get_node_type (shadow_child) == GSK_TEXT_NODE)
+        {
+          if (dx != 0 || dy != 0)
+            {
+              gsk_ngl_render_job_offset (job, dx, dy);
+              gsk_ngl_render_job_visit_text_node (job, shadow_child, &shadow->color, TRUE);
+              gsk_ngl_render_job_offset (job, -dx, -dy);
+            }
+          continue;
+        }
+
       if (shadow->radius > 0)
         {
           float min_x;


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