]> git.notmuchmail.org Git - xoboot/commitdiff
Change animation to use correct background colors
authorCarl Worth <cworth@cworth.org>
Tue, 28 Aug 2007 04:36:59 +0000 (21:36 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 28 Aug 2007 04:36:59 +0000 (21:36 -0700)
xoboot.c

index eee192f04f2cdf8aa37e52376a40bdc9a4dd7c01..ee6828997d3cd596492267b39ee4d4d70dcbe8af 100644 (file)
--- a/xoboot.c
+++ b/xoboot.c
@@ -8,6 +8,23 @@ typedef struct _state {
     double progress;
 } state_t;
 
+typedef struct _color {
+    double r;
+    double g;
+    double b;
+} color_t;
+
+#define HEX_COLOR(r,g,b) {(r) / 255.0, (g) / 255.0, (b) / 255.0}
+
+color_t background[2] = {
+    HEX_COLOR (0x75, 0x75, 0x75),
+    HEX_COLOR (0xdb, 0xdc, 0xdf)
+};
+
+#define LERP(a,b,t) ((a) + (t) * ((b) - (a)))
+#define LERP_COLORS(c0, c1, t) LERP((c0).r, (c1).r, (t)), \
+                              LERP((c0).g, (c1).g, (t)), \
+                              LERP((c0).b, (c1).b, (t))
 static gboolean
 xoboot_expose_event (GtkWidget      *widget,
                      GdkEventExpose *event,
@@ -18,7 +35,9 @@ xoboot_expose_event (GtkWidget      *widget,
 
     cr = gdk_cairo_create (widget->window);
 
-    cairo_set_source_rgb (cr, state->progress, 0, 0);
+    cairo_set_source_rgb (cr, LERP_COLORS (background[0],
+                                          background[1],
+                                          state->progress));
     cairo_paint (cr);
 
     cairo_destroy (cr);