r4379 - in trunk/src/target/OM-2007.2/libraries/moko-gtk-engine: . src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Fri Apr 18 17:29:08 CEST 2008


Author: thomas
Date: 2008-04-18 17:29:07 +0200 (Fri, 18 Apr 2008)
New Revision: 4379

Modified:
   trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog
   trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c
Log:
2008-04-18  Thomas Wood  <thomas at openedhand.com>

	* src/moko-draw.c: (moko_draw_option): Use cairo for draw_option because
	X arcs are ugly


Modified: trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog	2008-04-18 15:27:45 UTC (rev 4378)
+++ trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog	2008-04-18 15:29:07 UTC (rev 4379)
@@ -1,5 +1,10 @@
 2008-04-18  Thomas Wood  <thomas at openedhand.com>
 
+	* src/moko-draw.c: (moko_draw_option): Use cairo for draw_option because
+	X arcs are ugly
+
+2008-04-18  Thomas Wood  <thomas at openedhand.com>
+
 	* data/gtk-2.0/gtkrc: Fix notebooks so only GtkNotebook and
 	GtkNotebook.Gtklabel get styled
 

Modified: trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c
===================================================================
--- trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c	2008-04-18 15:27:45 UTC (rev 4378)
+++ trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c	2008-04-18 15:29:07 UTC (rev 4379)
@@ -159,25 +159,32 @@
 		  gint height)
 {
   cairo_t *cr;
+  gdouble cx, cy, radius;
 
   /* X arc drawing code is really ugly, so we use cairo here */
-  gdk_draw_arc (window, style->black_gc, TRUE,
-   x, y, width, height, 0, 360 * 64);
 
-  x += 2; y += 2;
-  width -= 4; height -=4;
+  cx = x + width / 2;
+  cy = y + width / 2;
+  radius = width / 2;
 
-  gdk_draw_arc (window, style->base_gc[state_type], TRUE,
-   x, y, width, height, 0, 360 * 64);
+  cr = gdk_cairo_create (window);
 
+  gdk_cairo_set_source_color (cr, &style->black);
+  cairo_arc (cr, cx, cy, radius, 0, 2 * M_PI);
+  cairo_fill (cr);
+
+
+  gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
+  cairo_arc (cr, cx, cy, radius - 2, 0, 2 * M_PI);
+  cairo_fill (cr);
+
   if (shadow_type == GTK_SHADOW_IN)
   {
-    x += 2; y += 2;
-    width -= 4; height -=4;
-
-    gdk_draw_arc (window, style->base_gc[GTK_STATE_SELECTED], TRUE,
-     x, y, width, height, 0, 360 * 64);
+    gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_SELECTED]);
+    cairo_arc (cr, cx, cy, radius - 4, 0, 2 * M_PI);
+    cairo_fill (cr);
   }
+  cairo_destroy (cr);
 }
 
 static void





More information about the commitlog mailing list