[gtk/wip/chergert/glproto] avoid some re-calculations of corners



commit d9388fd7ae1b8e00670de0a8b1f209ae072547ad
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 16 14:54:41 2021 -0800

    avoid some re-calculations of corners

 gsk/next/gskglrenderjob.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index d47636e26f..b1cc731734 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -1450,7 +1450,7 @@ gsk_gl_render_job_visit_rounded_clip_node (GskGLRenderJob      *job,
 
   gsk_gl_render_job_transform_bounds (job, &clip->bounds, &transformed_clip.bounds);
 
-  for (guint i = 0; i < G_N_ELEMENTS (clip->corner); i++)
+  for (guint i = 0; i < G_N_ELEMENTS (transformed_clip.corner); i++)
     {
       transformed_clip.corner[i].width = clip->corner[i].width * scale_x;
       transformed_clip.corner[i].height = clip->corner[i].height * scale_y;
@@ -1500,24 +1500,16 @@ gsk_gl_render_job_visit_rounded_clip_node (GskGLRenderJob      *job,
   else
     {
       GskGLRenderOffscreen offscreen = {0};
-      GskRoundedRect scaled_clip;
+
+      transformed_clip.bounds.origin.x = clip->bounds.origin.x * scale_x;
+      transformed_clip.bounds.origin.y = clip->bounds.origin.y * scale_y;
+      transformed_clip.bounds.size.width = clip->bounds.size.width * scale_x;
+      transformed_clip.bounds.size.height = clip->bounds.size.height * scale_y;
 
       offscreen.bounds = &node->bounds;
       offscreen.force_offscreen = TRUE;
 
-      scaled_clip.bounds.origin.x = clip->bounds.origin.x * scale_x;
-      scaled_clip.bounds.origin.y = clip->bounds.origin.y * scale_y;
-      scaled_clip.bounds.size.width = clip->bounds.size.width * scale_x;
-      scaled_clip.bounds.size.height = clip->bounds.size.height * scale_y;
-
-      /* Increase corner radius size by scale factor */
-      for (guint i = 0; i < 4; i ++)
-        {
-          scaled_clip.corner[i].width = clip->corner[i].width * scale_x;
-          scaled_clip.corner[i].height = clip->corner[i].height * scale_y;
-        }
-
-      gsk_gl_render_job_push_clip (job, &scaled_clip);
+      gsk_gl_render_job_push_clip (job, &transformed_clip);
       if (!gsk_gl_render_job_visit_node_with_offscreen (job, child, &offscreen))
         g_assert_not_reached ();
       gsk_gl_render_job_pop_clip (job);


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