murrine r77 - in trunk: . src



Author: acimitan
Date: Fri Sep 26 23:53:20 2008
New Revision: 77
URL: http://svn.gnome.org/viewvc/murrine?rev=77&view=rev

Log:
2008-09-27  Andrea Cimitan  <andrea cimitan gmail com>

	* TODO:
	* src/cairo-support.c (murrine_rounded_rectangle_closed):
	* src/cairo-support.h:
	* src/murrine_draw.c (murrine_draw_button), (murrine_draw_tab),
	(murrine_draw_menuitem), (murrine_draw_scrollbar_stepper):
	* src/murrine_draw_rgba.c (murrine_rgba_draw_button),
	(murrine_rgba_draw_tab), (murrine_rgba_draw_scrollbar_stepper):
	Less code, updated TODO


Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/src/cairo-support.c
   trunk/src/cairo-support.h
   trunk/src/murrine_draw.c
   trunk/src/murrine_draw_rgba.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Fri Sep 26 23:53:20 2008
@@ -4,8 +4,5 @@
 Notebooks:
 - adjust highlight, doesn't look perfectly with dark themes
 
-Entry:
-- add patch to support firefox's rounded corners
-
 Focus:
 - draw focus

Modified: trunk/src/cairo-support.c
==============================================================================
--- trunk/src/cairo-support.c	(original)
+++ trunk/src/cairo-support.c	Fri Sep 26 23:53:20 2008
@@ -431,6 +431,15 @@
 }
 
 void
+murrine_rounded_rectangle_closed (cairo_t *cr,
+                                  double x, double y, double w, double h,
+                                  int radius, uint8 corners)
+{
+	radius < 2 ? cairo_rectangle (cr, x, y, w, h) :
+	             clearlooks_rounded_rectangle (cr, x, y, w, h, radius, corners);
+}
+
+void
 murrine_draw_flat_highlight (cairo_t *cr,
                              int x, int y, int width, int height)
 {

Modified: trunk/src/cairo-support.h
==============================================================================
--- trunk/src/cairo-support.h	(original)
+++ trunk/src/cairo-support.h	Fri Sep 26 23:53:20 2008
@@ -71,6 +71,10 @@
                                                 double x, double y, double w, double h,
                                                 int radius, uint8 corners);
 
+G_GNUC_INTERNAL void murrine_rounded_rectangle_closed (cairo_t *cr,
+                                                       double x, double y, double w, double h,
+                                                       int radius, uint8 corners);
+
 G_GNUC_INTERNAL void murrine_rounded_rectangle_fast (cairo_t *cr,
                                                      double x, double y, double w, double h,
                                                      uint8 corners);

Modified: trunk/src/murrine_draw.c
==============================================================================
--- trunk/src/murrine_draw.c	(original)
+++ trunk/src/murrine_draw.c	Fri Sep 26 23:53:20 2008
@@ -199,10 +199,7 @@
 		murrine_shade (&border_normal, 0.8, &border_normal);
 
 	/* Draw the bg */
-	if (widget->roundness < 2)
-		cairo_rectangle (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2);
-	else
-		clearlooks_rounded_rectangle (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness, widget->corners);
+	murrine_rounded_rectangle_closed (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness, widget->corners);
 	murrine_set_gradient (cr, &fill, mrn_gradient_custom, xos+1, yos+1, 0, height-(yos*2)-2, widget->mrn_gradient.gradients, FALSE);
 
 	cairo_save (cr);
@@ -276,11 +273,8 @@
 
 		cairo_save (cr);
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, xos + 1, yos + 1, width-(xos*2)-2, height-(yos*2)-2);
-		else
-			clearlooks_rounded_rectangle (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness-1,
-			                              widget->corners & (MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMLEFT));
+		murrine_rounded_rectangle_closed (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness-1,
+		                                  widget->corners & (MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMLEFT));
 
 		cairo_clip (cr);
 
@@ -977,10 +971,7 @@
 	}
 
 	/* Set tab shape */
-	if (widget->roundness < 2)
-		cairo_rectangle (cr, 0, 0, width-1, height-1);
-	else
-		clearlooks_rounded_rectangle (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
+	murrine_rounded_rectangle_closed (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
 
 	/* Draw fill */
 	murrine_set_color_rgb (cr, fill);
@@ -1013,10 +1004,7 @@
 				break;
 		}
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, 0, 0, width-1, height-1);
-		else
-			clearlooks_rounded_rectangle (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
+		murrine_rounded_rectangle_closed (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
 
 		cairo_pattern_add_color_stop_rgb (pattern, 0.00, shade1.r, shade1.g, shade1.b);
 		cairo_pattern_add_color_stop_rgb (pattern, 0.45, shade2.r, shade2.g, shade2.b);
@@ -1049,10 +1037,7 @@
 				break;
 		}
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, 1, 1, width-3, height-3);
-		else
-			clearlooks_rounded_rectangle (cr, 1, 1, width-3, height-3, widget->roundness, widget->corners);
+		murrine_rounded_rectangle_closed (cr, 1, 1, width-3, height-3, widget->roundness, widget->corners);
 
 		cairo_pattern_add_color_stop_rgba (pattern, 0.00, shade1.r, shade1.g, shade1.b, 0.5);
 		cairo_pattern_add_color_stop_rgba (pattern, 0.45, shade2.r, shade2.g, shade2.b, 0.5);
@@ -1090,10 +1075,7 @@
 				break;
 		}
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, 0, 0, width-1, height-1);
-		else
-			clearlooks_rounded_rectangle (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
+		murrine_rounded_rectangle_closed (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
 
 		cairo_pattern_add_color_stop_rgb (pattern, 0.00, shade1.r, shade1.g, shade1.b);
 		cairo_pattern_add_color_stop_rgb (pattern, 0.45, shade2.r, shade2.g, shade2.b);
@@ -1126,10 +1108,7 @@
 				break;
 		}
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, 1, 1, width-3, height-3);
-		else
-			clearlooks_rounded_rectangle (cr, 1, 1, width-3, height-3, widget->roundness, widget->corners);
+		murrine_rounded_rectangle_closed (cr, 1, 1, width-3, height-3, widget->roundness, widget->corners);
 
 		cairo_pattern_add_color_stop_rgba (pattern, 0.00, shade1.r, shade1.g, shade1.b, 0.5);
 		cairo_pattern_add_color_stop_rgba (pattern, 0.45, shade2.r, shade2.g, shade2.b, 0.5);
@@ -1438,10 +1417,7 @@
 
 	cairo_translate      (cr, x, y);
 	cairo_set_line_width (cr, 1.0);
-	if (widget->roundness < 2)
-		cairo_rectangle (cr, 0, 0, width, height);
-	else
-		clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness, widget->corners);
+	murrine_rounded_rectangle_closed (cr, 0, 0, width, height, widget->roundness, widget->corners);
 	murrine_set_gradient (cr, fill, widget->mrn_gradient, 0, 0, 0, height, widget->mrn_gradient.gradients, FALSE);
 
 	/* Striped */
@@ -1581,10 +1557,7 @@
 	cairo_set_line_width (cr, 1.0);
 
 	/* Draw the bg */
-	if (widget->roundness < 2)
-		cairo_rectangle (cr, 1, 1, width-2, height-2);
-	else
-		murrine_rounded_rectangle (cr, 1, 1, width-2, height-2, widget->roundness, widget->corners);
+	murrine_rounded_rectangle_closed (cr, 1, 1, width-2, height-2, widget->roundness, widget->corners);
 	murrine_set_gradient (cr, fill, widget->mrn_gradient, 1, 1, 0, height-2, widget->mrn_gradient.gradients, FALSE);
 
 	cairo_save (cr);

Modified: trunk/src/murrine_draw_rgba.c
==============================================================================
--- trunk/src/murrine_draw_rgba.c	(original)
+++ trunk/src/murrine_draw_rgba.c	Fri Sep 26 23:53:20 2008
@@ -199,10 +199,7 @@
 		murrine_shade (&border_normal, 0.8, &border_normal);
 
 	/* Draw the bg */
-	if (widget->roundness < 2)
-		cairo_rectangle (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2);
-	else
-		clearlooks_rounded_rectangle (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness, widget->corners);
+	murrine_rounded_rectangle_closed (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness, widget->corners);
 	murrine_set_gradient (cr, &fill, mrn_gradient_custom, xos+1, yos+1, 0, height-(yos*2)-2, widget->mrn_gradient.gradients, FALSE);
 
 	cairo_save (cr);
@@ -281,11 +278,8 @@
 
 		cairo_save (cr);
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, xos + 1, yos + 1, width-(xos*2)-2, height-(yos*2)-2);
-		else
-			clearlooks_rounded_rectangle (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness-1,
-			                              widget->corners & (MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMLEFT));
+		murrine_rounded_rectangle_closed (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness-1,
+		                                  widget->corners & (MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMLEFT));
 
 		cairo_clip (cr);
 
@@ -1090,10 +1084,7 @@
 	cairo_paint (cr); */
 
 	/* Set tab shape */
-	if (widget->roundness < 2)
-		cairo_rectangle (cr, 0, 0, width-1, height-1);
-	else
-		clearlooks_rounded_rectangle (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
+	murrine_rounded_rectangle_closed (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
 
 	/* Draw fill */
 	if (!widget->active)
@@ -1129,10 +1120,7 @@
 				break;
 		}
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, 0, 0, width-1, height-1);
-		else
-			clearlooks_rounded_rectangle (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
+		murrine_rounded_rectangle_closed (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
 
 		cairo_pattern_add_color_stop_rgba (pattern, 0.00, shade1.r, shade1.g, shade1.b, NOTEBOOK_OPACITY);
 		cairo_pattern_add_color_stop_rgba (pattern, 0.45, shade2.r, shade2.g, shade2.b, NOTEBOOK_OPACITY);
@@ -1167,10 +1155,7 @@
 				break;
 		}
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, 1, 1, width-3, height-3);
-		else
-			clearlooks_rounded_rectangle (cr, 1, 1, width-3, height-3, widget->roundness, widget->corners);
+		murrine_rounded_rectangle_closed (cr, 1, 1, width-3, height-3, widget->roundness, widget->corners);
 
 		cairo_pattern_add_color_stop_rgba (pattern, 0.00, shade1.r, shade1.g, shade1.b, 0.5*NOTEBOOK_OPACITY);
 		cairo_pattern_add_color_stop_rgba (pattern, 0.45, shade2.r, shade2.g, shade2.b, 0.5*NOTEBOOK_OPACITY);
@@ -1208,10 +1193,7 @@
 				break;
 		}
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, 0, 0, width-1, height-1);
-		else
-			clearlooks_rounded_rectangle (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
+		murrine_rounded_rectangle_closed (cr, 0, 0, width-1, height-1, widget->roundness, widget->corners);
 
 		cairo_pattern_add_color_stop_rgba (pattern, 0.00, shade1.r, shade1.g, shade1.b, NOTEBOOK_OPACITY);
 		cairo_pattern_add_color_stop_rgba (pattern, 0.45, shade2.r, shade2.g, shade2.b, NOTEBOOK_OPACITY);
@@ -1246,10 +1228,7 @@
 				break;
 		}
 
-		if (widget->roundness < 2)
-			cairo_rectangle (cr, 1, 1, width-3, height-3);
-		else
-			clearlooks_rounded_rectangle (cr, 1, 1, width-3, height-3, widget->roundness, widget->corners);
+		murrine_rounded_rectangle_closed (cr, 1, 1, width-3, height-3, widget->roundness, widget->corners);
 
 		cairo_pattern_add_color_stop_rgba (pattern, 0.00, shade1.r, shade1.g, shade1.b, 0.5*NOTEBOOK_OPACITY);
 		cairo_pattern_add_color_stop_rgba (pattern, 0.45, shade2.r, shade2.g, shade2.b, 0.5*NOTEBOOK_OPACITY);
@@ -1327,10 +1306,7 @@
 	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
 
 	/* Draw the bg */
-	if (widget->roundness < 2)
-		cairo_rectangle (cr, 1, 1, width-2, height-2);
-	else
-		clearlooks_rounded_rectangle (cr, 1, 1, width-2, height-2, widget->roundness, widget->corners);
+	murrine_rounded_rectangle_closed (cr, 1, 1, width-2, height-2, widget->roundness, widget->corners);
 	murrine_set_gradient (cr, fill, widget->mrn_gradient, 1, 1, 0, height-2, widget->mrn_gradient.gradients, FALSE);
 
 	cairo_save (cr);



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