Skip to content
Snippets Groups Projects
Verified Commit 25876523 authored by Bruce Cowan's avatar Bruce Cowan :airplane:
Browse files

Lookup colours from style context

parent c505883a
No related branches found
No related tags found
No related merge requests found
...@@ -78,7 +78,7 @@ render_bar (GtkSnapshot *snapshot, ...@@ -78,7 +78,7 @@ render_bar (GtkSnapshot *snapshot,
float x, float x,
float w, float w,
float h, float h,
const GdkRGBA color) const GdkRGBA rgba)
{ {
graphene_rect_t area = GRAPHENE_RECT_INIT (x, 0.0, w, h); graphene_rect_t area = GRAPHENE_RECT_INIT (x, 0.0, w, h);
...@@ -89,7 +89,7 @@ render_bar (GtkSnapshot *snapshot, ...@@ -89,7 +89,7 @@ render_bar (GtkSnapshot *snapshot,
gtk_snapshot_push_rounded_clip (snapshot, &rounded); gtk_snapshot_push_rounded_clip (snapshot, &rounded);
gtk_snapshot_append_color (snapshot, gtk_snapshot_append_color (snapshot,
&color, &rgba,
&area); &area);
gtk_snapshot_pop (snapshot); gtk_snapshot_pop (snapshot);
...@@ -122,13 +122,15 @@ rugby_possibility_widget_snapshot (GtkWidget *widget, ...@@ -122,13 +122,15 @@ rugby_possibility_widget_snapshot (GtkWidget *widget,
NULL); NULL);
int score = tries * try_points + utries * utry_points + kicks * kick_points; int score = tries * try_points + utries * utry_points + kicks * kick_points;
GtkStyleContext *ctx = gtk_widget_get_style_context (widget);
GdkRGBA rgba;
// Tries // Tries
float w = width / (score / (float) try_points); float w = width / (score / (float) try_points);
for (int i = 0; i < tries; i++) for (int i = 0; i < tries; i++)
{ {
// Green gtk_style_context_lookup_color (ctx, "green_3", &rgba);
render_bar (snapshot, x, w, height, render_bar (snapshot, x, w, height, rgba);
(GdkRGBA) { 0.20, 0.82, 0.48, 1.0 });
x += w; x += w;
} }
...@@ -136,9 +138,8 @@ rugby_possibility_widget_snapshot (GtkWidget *widget, ...@@ -136,9 +138,8 @@ rugby_possibility_widget_snapshot (GtkWidget *widget,
w = width / (score / (float) utry_points); w = width / (score / (float) utry_points);
for (int i = 0; i < utries; i++) for (int i = 0; i < utries; i++)
{ {
// Red gtk_style_context_lookup_color (ctx, "red_3", &rgba);
render_bar (snapshot, x, w, height, render_bar (snapshot, x, w, height, rgba);
(GdkRGBA) { 0.88, 0.11, 0.14, 1.0 });
x += w; x += w;
} }
...@@ -146,9 +147,8 @@ rugby_possibility_widget_snapshot (GtkWidget *widget, ...@@ -146,9 +147,8 @@ rugby_possibility_widget_snapshot (GtkWidget *widget,
w = width / (score / (float) kick_points); w = width / (score / (float) kick_points);
for (int i = 0; i < kicks; i++) for (int i = 0; i < kicks; i++)
{ {
// Yellow gtk_style_context_lookup_color (ctx, "yellow_3", &rgba);
render_bar (snapshot, x, w, height, render_bar (snapshot, x, w, height, rgba);
(GdkRGBA) { 0.96, 0.83, 0.18, 1.0 });
x += w; x += w;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment