25
25
static double slices [N_HANDS ] = { 0.0 , };
26
26
27
27
static ClutterActor * hands [N_HANDS ] = { NULL , };
28
+ static ClutterColor hands_color [N_HANDS ];
28
29
29
30
static const char * colors [N_HANDS ] = {
30
31
"#4e9a06" ,
@@ -51,15 +52,12 @@ hand_paint (ClutterActor *hand)
51
52
52
53
float radius = clutter_actor_get_width (hand ) / 2.0 + 0.5 ;
53
54
54
- ClutterColor hand_color ;
55
- clutter_rectangle_get_color (CLUTTER_RECTANGLE (hand ), & hand_color );
56
-
57
55
CoglColor fill_color ;
58
56
cogl_color_init_from_4ub (& fill_color ,
59
- hand_color .red ,
60
- hand_color .green ,
61
- hand_color .blue ,
62
- hand_color .alpha );
57
+ hands_color [ hand_id ] .red ,
58
+ hands_color [ hand_id ] .green ,
59
+ hands_color [ hand_id ] .blue ,
60
+ hands_color [ hand_id ] .alpha );
63
61
64
62
cogl_set_source_color (& fill_color );
65
63
@@ -157,10 +155,8 @@ main (int argc, char *argv[])
157
155
158
156
for (int i = SECONDS ; i < N_HANDS ; i ++ )
159
157
{
160
- ClutterColor color ;
161
-
162
- clutter_color_from_string (& color , colors [i ]);
163
- hands [i ] = clutter_rectangle_new_with_color (& color );
158
+ clutter_color_from_string (& hands_color [i ], colors [i ]);
159
+ hands [i ] = clutter_actor_new ();
164
160
clutter_actor_set_size (hands [i ], (HAND_WIDTH * 3.0 ) * i , (HAND_WIDTH * 3.0 ) * i );
165
161
clutter_actor_add_constraint (hands [i ], clutter_align_constraint_new (stage , CLUTTER_ALIGN_X_AXIS , 0.5 ));
166
162
clutter_actor_add_constraint (hands [i ], clutter_align_constraint_new (stage , CLUTTER_ALIGN_Y_AXIS , 0.5 ));
0 commit comments