[gnumeric] GnmColor: take advantage of GO_COLOR_TO_CAIRO.



commit e737e6d57106f8b4d60b8b5a9f3f46bf1629f10d
Author: Morten Welinder <terra gnome org>
Date:   Wed Sep 2 19:36:52 2009 -0400

    GnmColor: take advantage of GO_COLOR_TO_CAIRO.

 src/pattern.c         |    8 ++------
 src/print-cell.c      |    6 ++----
 src/style-border.c    |    6 ++----
 src/tools/scenarios.c |    8 ++++----
 4 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/src/pattern.c b/src/pattern.c
index c3bc186..7e767a5 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -129,14 +129,10 @@ gnumeric_background_set_gtk (GnmStyle const *mstyle, cairo_t *context)
 		 */
 		if (pattern == 24) {
 			GnmColor const *pat_col = gnm_style_get_pattern_color (mstyle);
-			GOColor c;
 			g_return_val_if_fail (pat_col != NULL, FALSE);
 
-			c = pat_col->go_color;
-			cairo_set_source_rgb (context,
-					      GO_DOUBLE_RGBA_R (c),
-					      GO_DOUBLE_RGBA_G (c),
-					      GO_DOUBLE_RGBA_B (c));
+			cairo_set_source_rgba (context,
+					       GO_COLOR_TO_CAIRO (pat_col->go_color));
 		}
 #if 0
 		/* FIXME: How to do the other patterns? */
diff --git a/src/print-cell.c b/src/print-cell.c
index 1cc44e6..372753a 100644
--- a/src/print-cell.c
+++ b/src/print-cell.c
@@ -110,10 +110,8 @@ print_cell_gtk (GnmCell const *cell, GnmStyle const *mstyle,
 		}
 #endif
 		/* Set the font colour */
-		cairo_set_source_rgb (context,
-			 GO_UINT_RGBA_R (fore_color) / 255.,
-			 GO_UINT_RGBA_G (fore_color) / 255.,
-			 GO_UINT_RGBA_B (fore_color) / 255.);
+		cairo_set_source_rgba (context,
+				       GO_COLOR_TO_CAIRO (fore_color));
 
 		cairo_translate (context, x1+0.5, y1);
 
diff --git a/src/style-border.c b/src/style-border.c
index f74b1da..5d0b577 100644
--- a/src/style-border.c
+++ b/src/style-border.c
@@ -562,10 +562,8 @@ style_border_set_gtk (GnmBorder const * const border,
 		return FALSE;
 
 	gnm_style_border_set_dash (border->line_type, context);
-	cairo_set_source_rgb (context,
-			      GO_DOUBLE_RGBA_R (border->color->go_color),
-			      GO_DOUBLE_RGBA_G (border->color->go_color),
-			      GO_DOUBLE_RGBA_B (border->color->go_color));
+	cairo_set_source_rgba (context,
+			       GO_COLOR_TO_CAIRO (border->color->go_color));
 	return TRUE;
 }
 
diff --git a/src/tools/scenarios.c b/src/tools/scenarios.c
index 7758bfa..db657d5 100644
--- a/src/tools/scenarios.c
+++ b/src/tools/scenarios.c
@@ -570,7 +570,7 @@ summary_cb (int col, int row, GnmValue *v, summary_cb_t *p)
 		/* Set the colors. */
 		dao_set_colors (&p->dao, 2 + p->col, 3 + *index,
 				2 + p->col, 3 + *index,
-				style_color_new_gdk (&gs_black),
+				style_color_new_go (GO_RGBA_BLACK),
 				style_color_new_gdk (&gs_light_gray));
 	
 	} else {
@@ -593,7 +593,7 @@ summary_cb (int col, int row, GnmValue *v, summary_cb_t *p)
 		/* Set the colors. */
 		dao_set_colors (&p->dao, 2 + p->col, 3 + p->row,
 				2 + p->col, 3 + p->row,
-				style_color_new_gdk (&gs_black),
+				style_color_new_go (GO_RGBA_BLACK),
 				style_color_new_gdk (&gs_light_gray));
 	
 		/* Insert row number into the hash table. */
@@ -724,10 +724,10 @@ scenario_summary (WorkbookControl *wbc,
 	dao_set_cell (&cb.dao, 0, 0, _("Scenario Summary"));
 
 	dao_set_colors (&cb.dao, 0, 0, cb.col + 1, 1,
-			style_color_new_gdk (&gs_white),
+			style_color_new_go (GO_RGBA_WHITE),
 			style_color_new_gdk (&gs_dark_gray));
 	dao_set_colors (&cb.dao, 0, 2, 0, 2 + cb.row,
-			style_color_new_gdk (&gs_black),
+			style_color_new_go (GO_RGBA_BLACK),
 			style_color_new_gdk (&gs_light_gray));
 
 	dao_set_align (&cb.dao, 1, 1, cb.col + 1, 1, HALIGN_RIGHT, 



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