[gtk+] theme: Compute scale values once



commit 41b5a6a900a625771366f3492ac2b9463feabf4b
Author: Benjamin Otte <otte redhat com>
Date:   Sat Mar 5 14:49:19 2011 +0100

    theme: Compute scale values once
    
    Use a local variable to store the xscale and yscale, so that it's only
    computed once.
    Makes it easier to do the changes I'm about to do.

 gtk/gtkthemingengine.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index bd32c90..2fdec73 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -3005,6 +3005,8 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
           /* transparency is a function of time and intial value */
           gdouble t = (gdouble) ((i + num_steps - step)
                                  % num_steps) / num_steps;
+          gdouble xscale = cos (i * G_PI / half);
+          gdouble yscale = sin (i * G_PI / half);
 
           cairo_set_source_rgba (cr,
                                  color->red,
@@ -3013,11 +3015,11 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
                                  color->alpha * t);
 
           cairo_move_to (cr,
-                         (radius - inset) * cos (i * G_PI / half),
-                         (radius - inset) * sin (i * G_PI / half));
+                         (radius - inset) * xscale,
+                         (radius - inset) * yscale);
           cairo_line_to (cr,
-                         radius * cos (i * G_PI / half),
-                         radius * sin (i * G_PI / half));
+                         radius * xscale,
+                         radius * yscale);
           cairo_stroke (cr);
         }
 



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