murrine r92 - in trunk: . src
- From: acimitan svn gnome org
- To: svn-commits-list gnome org
- Subject: murrine r92 - in trunk: . src
- Date: Fri, 3 Oct 2008 10:54:34 +0000 (UTC)
Author: acimitan
Date: Fri Oct 3 10:54:33 2008
New Revision: 92
URL: http://svn.gnome.org/viewvc/murrine?rev=92&view=rev
Log:
2008-10-03 Andrea Cimitan <andrea cimitan gmail com>
* src/cairo-support.c (murrine_rgb_to_hls), (murrine_hls_to_rgb),
(murrine_shade), (murrine_mix_color), (murrine_gdk_color_to_rgb),
(get_decreased_ratio), (get_increased_ratio):
* src/murrine_draw.c (murrine_draw_inset), (murrine_draw_button),
(murrine_draw_entry), (murrine_draw_spinbutton_down),
(murrine_draw_scale_trough), (murrine_draw_progressbar_trough),
(murrine_draw_progressbar_fill), (murrine_draw_optionmenu),
(murrine_draw_menubar), (murrine_draw_toolbar),
(murrine_draw_frame), (murrine_draw_tab), (murrine_draw_separator),
(murrine_draw_combo_separator), (murrine_draw_list_view_header),
(murrine_draw_menuitem), (murrine_draw_scrollbar_trough),
(murrine_draw_scrollbar_stepper), (murrine_draw_scrollbar_slider),
(murrine_draw_selected_cell), (murrine_draw_statusbar),
(murrine_draw_menu_frame), (murrine_draw_tooltip),
(murrine_draw_handle), (murrine_draw_normal_arrow),
(murrine_draw_combo_arrow), (_murrine_draw_arrow),
(murrine_draw_arrow), (murrine_draw_radiobutton),
(murrine_draw_checkbox), (murrine_draw_resize_grip):
* src/murrine_draw_rgba.c (murrine_draw_inset),
(murrine_rgba_draw_button), (murrine_rgba_draw_entry),
(murrine_rgba_draw_scale_trough),
(murrine_rgba_draw_progressbar_trough),
(murrine_rgba_draw_progressbar_fill), (murrine_rgba_draw_menubar),
(murrine_rgba_draw_toolbar), (murrine_rgba_draw_frame),
(murrine_rgba_draw_separator), (murrine_rgba_draw_tab),
(murrine_rgba_draw_scrollbar_trough),
(murrine_rgba_draw_scrollbar_stepper),
(murrine_rgba_draw_scrollbar_slider), (murrine_rgba_draw_tooltip),
(murrine_rgba_draw_handle), (murrine_rgba_draw_radiobutton),
(murrine_rgba_draw_checkbox), (murrine_rgba_draw_menu_frame),
(murrine_rgba_draw_statusbar):
* src/murrine_style.c (murrine_style_draw_shadow),
(murrine_style_draw_box), (murrine_style_draw_option),
(murrine_style_draw_check), (murrine_style_draw_layout),
(murrine_style_realize), (gdk_cairo_set_source_color_alpha),
(murrine_style_draw_focus), (murrine_style_copy),
(murrine_style_unrealize), (set_transparency),
(murrine_style_init), (murrine_style_class_init):
Polishing code - Part 3
Removed cairo_set_line_width (cr, 1.0) and use cairo save and restore
Modified:
trunk/ChangeLog
trunk/src/cairo-support.c
trunk/src/murrine_draw.c
trunk/src/murrine_draw_rgba.c
trunk/src/murrine_rc_style.c
trunk/src/murrine_style.c
Modified: trunk/src/cairo-support.c
==============================================================================
--- trunk/src/cairo-support.c (original)
+++ trunk/src/cairo-support.c Fri Oct 3 10:54:33 2008
@@ -66,8 +66,8 @@
min = blue;
}
- l = (max + min) / 2;
- if (fabs(max - min) < 0.0001)
+ l = (max+min)/2;
+ if (fabs (max-min) < 0.0001)
{
h = 0;
s = 0;
@@ -75,17 +75,17 @@
else
{
if (l <= 0.5)
- s = (max - min) / (max + min);
+ s = (max-min)/(max+min);
else
- s = (max - min) / (2 - max - min);
+ s = (max-min)/(2-max-min);
delta = max -min;
if (red == max)
- h = (green - blue) / delta;
+ h = (green-blue)/delta;
else if (green == max)
- h = 2 + (blue - red) / delta;
+ h = 2+(blue-red)/delta;
else if (blue == max)
- h = 4 + (red - green) / delta;
+ h = 4+(red-green)/delta;
h *= 60;
if (h < 0.0)
@@ -112,11 +112,11 @@
saturation = *s;
if (lightness <= 0.5)
- m2 = lightness * (1 + saturation);
+ m2 = lightness*(1+saturation);
else
- m2 = lightness + saturation - lightness * saturation;
+ m2 = lightness+saturation-lightness*saturation;
- m1 = 2 * lightness - m2;
+ m1 = 2*lightness-m2;
if (saturation == 0)
{
@@ -126,18 +126,18 @@
}
else
{
- hue = *h + 120;
+ hue = *h+120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
- r = m1 + (m2 - m1) * hue / 60;
+ r = m1+(m2-m1)*hue/60;
else if (hue < 180)
r = m2;
else if (hue < 240)
- r = m1 + (m2 - m1) * (240 - hue) / 60;
+ r = m1+(m2-m1)*(240-hue)/60;
else
r = m1;
@@ -148,26 +148,26 @@
hue += 360;
if (hue < 60)
- g = m1 + (m2 - m1) * hue / 60;
+ g = m1+(m2-m1)*hue/60;
else if (hue < 180)
g = m2;
else if (hue < 240)
- g = m1 + (m2 - m1) * (240 - hue) / 60;
+ g = m1+(m2-m1)*(240-hue)/60;
else
g = m1;
- hue = *h - 120;
+ hue = *h-120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
- b = m1 + (m2 - m1) * hue / 60;
+ b = m1+(m2-m1)*hue/60;
else if (hue < 180)
b = m2;
else if (hue < 240)
- b = m1 + (m2 - m1) * (240 - hue) / 60;
+ b = m1+(m2-m1)*(240-hue)/60;
else
b = m1;
@@ -178,7 +178,7 @@
}
void
-murrine_shade (const MurrineRGB * a, float k, MurrineRGB * b)
+murrine_shade (const MurrineRGB *a, float k, MurrineRGB *b)
{
double red;
double green;
@@ -223,17 +223,17 @@
{
g_return_if_fail (color1 && color2 && composite);
- composite->r = color1->r * (1-mix_factor) + color2->r * mix_factor;
- composite->g = color1->g * (1-mix_factor) + color2->g * mix_factor;
- composite->b = color1->b * (1-mix_factor) + color2->b * mix_factor;
+ composite->r = color1->r*(1-mix_factor)+color2->r*mix_factor;
+ composite->g = color1->g*(1-mix_factor)+color2->g*mix_factor;
+ composite->b = color1->b*(1-mix_factor)+color2->b*mix_factor;
}
void
murrine_gdk_color_to_rgb (GdkColor *c, double *r, double *g, double *b)
{
- *r = (double)c->red / (double)65535;
- *g = (double)c->green / (double)65535;
- *b = (double)c->blue / (double)65535;
+ *r = (double)c->red/(double)65535;
+ *g = (double)c->green/(double)65535;
+ *b = (double)c->blue/(double)65535;
}
void
@@ -249,7 +249,7 @@
parent = widget->parent;
stop = FALSE;
-
+
while (parent && !stop)
{
stop = FALSE;
@@ -263,7 +263,7 @@
{
GtkShadowType shadow = GTK_SHADOW_OUT;
gtk_widget_style_get (GTK_WIDGET (parent), "shadow-type", &shadow, NULL);
-
+
stop |= (shadow != GTK_SHADOW_NONE);
}
@@ -722,9 +722,9 @@
get_decreased_ratio (double old, double factor)
{
if (old > 1.0)
- return ((old-1.0)/factor + 1.0);
+ return ((old-1.0)/factor+1.0);
else if (old < 1.0)
- return (1.0 - (1.0-old)/factor);
+ return (1.0-(1.0-old)/factor);
return old;
}
@@ -733,9 +733,9 @@
get_increased_ratio (double old, double factor)
{
if (old > 1.0)
- return ((old-1.0)*factor + 1.0);
+ return ((old-1.0)*factor+1.0);
else if (old < 1.0)
- return (1.0 - (1.0-old)*factor);
+ return (1.0-(1.0-old)*factor);
return old;
}
Modified: trunk/src/murrine_draw.c
==============================================================================
--- trunk/src/murrine_draw.c (original)
+++ trunk/src/murrine_draw.c Fri Oct 3 10:54:33 2008
@@ -40,43 +40,43 @@
murrine_shade (bg_color, 1.4, &highlight);
/* highlight */
- cairo_move_to (cr, x + w + (radius * -0.2928932188), y - (radius * -0.2928932188));
+ cairo_move_to (cr, x+w+(radius*-0.2928932188), y-(radius*-0.2928932188));
if (corners & MRN_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.75, M_PI * 2);
+ cairo_arc (cr, x+w-radius, y+radius, radius, M_PI*1.75, M_PI*2);
else
- cairo_line_to (cr, x + w, y);
+ cairo_line_to (cr, x+w, y);
if (corners & MRN_CORNER_BOTTOMRIGHT)
- cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, M_PI * 0.5);
+ cairo_arc (cr, x+w-radius, y+h-radius, radius, 0, M_PI*0.5);
else
- cairo_line_to (cr, x + w, y + h);
+ cairo_line_to (cr, x+w, y+h);
if (corners & MRN_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.5, M_PI * 0.75);
+ cairo_arc (cr, x+radius, y+h-radius, radius, M_PI*0.5, M_PI*0.75);
else
- cairo_line_to (cr, x, y + h);
+ cairo_line_to (cr, x, y+h);
murrine_set_color_rgba (cr, &highlight, 0.45);
cairo_stroke (cr);
/* shadow */
- cairo_move_to (cr, x + (radius * 0.2928932188), y + h + (radius * -0.2928932188));
+ cairo_move_to (cr, x+(radius*0.2928932188), y+h+(radius*-0.2928932188));
if (corners & MRN_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.75, M_PI);
+ cairo_arc (cr, x+radius, y+h-radius, radius, M_PI*0.75, M_PI);
else
- cairo_line_to (cr, x, y + h);
+ cairo_line_to (cr, x, y+h);
if (corners & MRN_CORNER_TOPLEFT)
- cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
+ cairo_arc (cr, x+radius, y+radius, radius, M_PI, M_PI*1.5);
else
cairo_line_to (cr, x, y);
if (corners & MRN_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
+ cairo_arc (cr, x+w-radius, y+radius, radius, M_PI*1.5, M_PI*1.75);
else
- cairo_line_to (cr, x + w, y);
+ cairo_line_to (cr, x+w, y);
murrine_set_color_rgba (cr, &shadow, 0.15);
cairo_stroke (cr);
@@ -173,7 +173,6 @@
murrine_exchange_axis (cr, &x, &y, &width, &height);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
if (!widget->active && !widget->disabled && widget->reliefstyle > 1)
{
@@ -253,7 +252,6 @@
int radius = CLAMP (widget->roundness, 0, 3);
cairo_translate (cr, x+0.5, y+0.5);
- cairo_set_line_width (cr, 1.0);
/* Fill the entry's base color */
cairo_rectangle (cr, 1.5, 1.5, width-4, height-4);
@@ -297,13 +295,11 @@
{
cairo_pattern_t *pat;
MurrineRGB shadow;
-
murrine_shade (&colors->bg[0], 0.8, &shadow);
cairo_translate (cr, x+1, y+1);
cairo_rectangle (cr, 1, 1, width-4, height-4);
-
pat = cairo_pattern_create_linear (0, 0, 0, height);
murrine_pattern_add_color_stop_rgb (pat, 0.0, &shadow);
murrine_pattern_add_color_stop_rgba (pat, 1.0, &shadow, 0.0);
@@ -349,7 +345,7 @@
if (fill_size > width-3)
fill_size = width-3;
- fill_x = slider->inverted ? width - fill_size - 3 : 0;
+ fill_x = slider->inverted ? width-fill_size-3 : 0;
fill_y = 0;
fill_width = fill_size;
fill_height = TROUGH_SIZE-2;
@@ -357,8 +353,8 @@
trough_width = width-3;
trough_height = TROUGH_SIZE-2;
- translate_x = x + 0.5;
- translate_y = y + 0.5 + (height/2) - (TROUGH_SIZE/2);
+ translate_x = x+0.5;
+ translate_y = y+0.5+(height/2)-(TROUGH_SIZE/2);
}
else
{
@@ -366,18 +362,17 @@
fill_size = height-3;
fill_x = 0;
- fill_y = slider->inverted ? height - fill_size - 3 : 0;
+ fill_y = slider->inverted ? height-fill_size-3 : 0;
fill_width = TROUGH_SIZE-2;
fill_height = fill_size;
trough_width = TROUGH_SIZE-2;
trough_height = height-3;
- translate_x = x + 0.5 + (width/2) - (TROUGH_SIZE/2);
- translate_y = y + 0.5;
+ translate_x = x+0.5+(width/2)-(TROUGH_SIZE/2);
+ translate_y = y+0.5;
}
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, translate_x, translate_y);
if (widget->reliefstyle != 0)
@@ -441,8 +436,6 @@
murrine_shade (&widget->parentbg, 0.95, &fill);
- cairo_set_line_width (cr, 1.0);
-
/* Create trough box */
cairo_rectangle (cr, x+1, y+1, width-2, height-2);
murrine_set_color_rgba (cr, &fill, 0.44);
@@ -516,12 +509,12 @@
rotate_mirror_translate (cr, M_PI/2, x, y+width, TRUE, FALSE);
}
+ stroke_width = height*2;
+ x_step = (((float)stroke_width/10)*offset);
+
cairo_save (cr);
cairo_clip (cr);
- stroke_width = height*2;
- x_step = (((float)stroke_width/10)*offset);
- cairo_set_line_width (cr, 1.0);
cairo_save (cr);
cairo_rectangle (cr, 2, 1, width-4, height-2);
@@ -533,7 +526,7 @@
while (tile_pos <= width+x_step-2)
{
cairo_move_to (cr, stroke_width/2-x_step, 0);
- cairo_line_to (cr, stroke_width-x_step, 0);
+ cairo_line_to (cr, stroke_width-x_step, 0);
cairo_line_to (cr, stroke_width/2-x_step, height);
cairo_line_to (cr, -x_step, height);
@@ -570,7 +563,6 @@
/* Draw the separator */
MurrineRGB *dark = (MurrineRGB*)&colors->shade[6];
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, optionmenu->linepos+0.5, 1);
murrine_set_color_rgba (cr, dark, 0.4);
@@ -636,8 +628,6 @@
cairo_fill (cr);
cairo_pattern_destroy (pat);
- cairo_set_line_width (cr, 1.0);
-
murrine_shade (&low, 0.9, &low);
murrine_set_color_rgb (cr, &low);
while (counter < width)
@@ -656,7 +646,6 @@
cairo_rectangle (cr, 0.5, 0.5, width-1, height-1);
else
{
- cairo_set_line_width (cr, 1.0);
cairo_move_to (cr, 0, height-0.5);
cairo_line_to (cr, width, height-0.5);
}
@@ -677,7 +666,6 @@
const MurrineRGB *fill = &colors->bg[0];
const MurrineRGB *top = &colors->shade[0];
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x, y);
cairo_rectangle (cr, 0, 0, width, height);
@@ -790,7 +778,6 @@
murrine_get_frame_gap_clip (x, y, width, height,
frame, &bevel_clip, &frame_clip);
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y+0.5);
/* save everything */
@@ -873,8 +860,6 @@
cairo_clip (cr);
cairo_new_path (cr);
- /* Translate and set line width */
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y+0.5);
/* Make the tabs slightly bigger than they should be, to create a gap */
@@ -1060,7 +1045,6 @@
if (separator->horizontal)
{
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x, y+0.5);
murrine_set_color_rgb (cr, dark);
@@ -1075,7 +1059,6 @@
}
else
{
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y);
murrine_set_color_rgb (cr, dark);
@@ -1098,7 +1081,6 @@
{
const MurrineRGB *dark = &colors->shade[6];
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y);
murrine_set_color_rgba (cr, dark, 0.4);
@@ -1120,7 +1102,6 @@
murrine_shade (border, 1.3, &highlight);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
if (header->order & MRN_ORDER_FIRST)
{
@@ -1179,12 +1160,11 @@
{
if (header->style == 1 && widget->glazestyle > 0)
{
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, width-0.5, 0);
+ murrine_set_color_rgb (cr, border);
cairo_move_to (cr, 0, 0);
cairo_line_to (cr, 0, height);
- murrine_set_color_rgb (cr, border);
cairo_stroke (cr);
}
else
@@ -1208,7 +1188,6 @@
const MurrineRGB *border = &colors->spot[2];
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
murrine_rounded_rectangle_closed (cr, 0, 0, width, height, widget->roundness, widget->corners);
switch (menuitemstyle)
@@ -1234,17 +1213,19 @@
{
murrine_set_gradient (cr, fill, widget->mrn_gradient, 0, 0, 0, height, widget->mrn_gradient.gradients, FALSE);
cairo_fill (cr);
+
double tile_pos = 0;
double stroke_width;
int x_step;
stroke_width = height*2;
- cairo_save (cr);
x_step = (((float)stroke_width/10));
+
+ cairo_save (cr);
/* Draw strokes */
while (tile_pos <= width+x_step-2)
{
cairo_move_to (cr, stroke_width/2-x_step, 0);
- cairo_line_to (cr, stroke_width-x_step, 0);
+ cairo_line_to (cr, stroke_width-x_step, 0);
cairo_line_to (cr, stroke_width/2-x_step, height);
cairo_line_to (cr, -x_step, height);
cairo_translate (cr, stroke_width, 0);
@@ -1274,8 +1255,6 @@
murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.95 : 1.065, &fill);
- cairo_set_line_width (cr, 1.0);
-
if (!scrollbar->horizontal)
{
cairo_translate (cr, x, y);
@@ -1319,7 +1298,6 @@
murrine_mix_color (&border, fill, 0.4, &border);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
/* Draw the bg */
murrine_rounded_rectangle_closed (cr, 1, 1, width-2, height-2, widget->roundness-1, widget->corners);
@@ -1392,8 +1370,6 @@
width = tmp;
}
- cairo_set_line_width (cr, 1.0);
-
murrine_set_color_rgb (cr, &border);
murrine_rounded_rectangle_fast (cr, 0.5, 0.5, width-1, height-1, widget->corners);
cairo_stroke (cr);
@@ -1439,7 +1415,7 @@
cairo_rectangle (cr, 1, 1, width-2, height-2);
cairo_clip (cr);
cairo_new_path (cr);
- cairo_set_line_width (cr, 5); /* stroke width */
+ cairo_set_line_width (cr, 5.0); /* stroke width */
murrine_set_color_rgba (cr, &style, 0.08);
while (counter < height)
{
@@ -1470,9 +1446,9 @@
}
}
/* Draw the handle */
- if (scrollbar->style > 0 && scrollbar->style % 2 == 0 )
+ if (scrollbar->style > 0 && scrollbar->style % 2 == 0)
{
- int bar_x = width/2 - 4;
+ int bar_x = width/2-4;
cairo_translate (cr, 0.5, 0.5);
int i;
for (i=0; i<3; i++)
@@ -1498,6 +1474,7 @@
MurrineRGB fill = widget->focus ? colors->base[widget->state_type] :
colors->base[GTK_STATE_ACTIVE];
MurrineRGB border;
+ murrine_shade (&fill, (!widget->mrn_gradient.gradients ? 0.9 : 0.95), &border);
cairo_save (cr);
cairo_translate (cr, x, y);
@@ -1506,8 +1483,6 @@
cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);
- murrine_shade (&fill, (!widget->mrn_gradient.gradients ? 0.9 : 0.95), &border);
-
murrine_set_color_rgb (cr, &border);
cairo_move_to (cr, 0, 0.5);
cairo_rel_line_to (cr, width, 0);
@@ -1527,7 +1502,6 @@
const MurrineRGB *dark = &colors->shade[3];
const MurrineRGB *highlight = &colors->shade[0];
- cairo_set_line_width (cr, 1);
cairo_translate (cr, x, y+0.5);
murrine_set_color_rgb (cr, dark);
@@ -1551,7 +1525,6 @@
const MurrineRGB *border = &colors->shade[5];
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1);
murrine_set_color_rgb (cr, border);
cairo_rectangle (cr, 0.5, 0.5, width-1, height-1);
@@ -1589,7 +1562,6 @@
cairo_save (cr);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
murrine_set_gradient (cr, &colors->bg[widget->state_type], mrn_gradient_custom, 0, 0, 0, height, widget->mrn_gradient.gradients, FALSE);
cairo_rectangle (cr, 0, 0, width, height);
@@ -1620,22 +1592,20 @@
int num_bars, bar_spacing;
num_bars = 3;
bar_spacing = 3;
- bar_height = num_bars * bar_spacing;
+ bar_height = num_bars*bar_spacing;
if (handle->horizontal)
{
int tmp = height;
- rotate_mirror_translate (cr, M_PI/2, x + 0.5 + width/2 - bar_height/2, y + height/2 - bar_width/2, FALSE, FALSE);
+ rotate_mirror_translate (cr, M_PI/2, x+0.5+width/2-bar_height/2, y+height/2-bar_width/2, FALSE, FALSE);
height = width;
width = tmp;
}
else
{
- cairo_translate (cr, x + width/2 - bar_width/2, y + height/2 - bar_height/2 + 0.5);
+ cairo_translate (cr, x+width/2-bar_width/2, y+height/2-bar_height/2+0.5);
}
- cairo_set_line_width (cr, 1.0);
-
for (i=0; i<num_bars; i++)
{
cairo_move_to (cr, 0, bar_y);
@@ -1658,18 +1628,17 @@
cairo_save (cr);
- arrow_width = MIN (height * 2.0 + MAX (1.0, ceil (height * 2.0 / 6.0 * 2.0) / 2.0) / 2.0, width);
- line_width_2 = MAX (1.0, ceil (arrow_width / 6.0 * 2.0) / 2.0) / 2.0;
- arrow_height = arrow_width / 2.0 + line_width_2;
-
- cairo_translate (cr, x, y - arrow_height / 2.0);
-
- cairo_move_to (cr, -arrow_width / 2.0, line_width_2);
- cairo_line_to (cr, -arrow_width / 2.0 + line_width_2, 0);
- /* cairo_line_to (cr, 0, arrow_height - line_width_2); */
- cairo_arc_negative (cr, 0, arrow_height - 2*line_width_2 - 2*line_width_2 * sqrt(2), 2*line_width_2, M_PI_2 + M_PI_4, M_PI_4);
- cairo_line_to (cr, arrow_width / 2.0 - line_width_2, 0);
- cairo_line_to (cr, arrow_width / 2.0, line_width_2);
+ arrow_width = MIN (height*2.0 + MAX (1.0, ceil (height*2.0/6.0*2.0)/2.0)/2.0, width);
+ line_width_2 = MAX (1.0, ceil (arrow_width/6.0*2.0)/2.0)/2.0;
+ arrow_height = arrow_width/2.0+line_width_2;
+
+ cairo_translate (cr, x, y-arrow_height/2.0);
+
+ cairo_move_to (cr, -arrow_width/2.0, line_width_2);
+ cairo_line_to (cr, -arrow_width/2.0 + line_width_2, 0);
+ cairo_arc_negative (cr, 0, arrow_height-2*line_width_2-2*line_width_2*sqrt(2), 2*line_width_2, M_PI_2+M_PI_4, M_PI_4);
+ cairo_line_to (cr, arrow_width/2.0-line_width_2, 0);
+ cairo_line_to (cr, arrow_width/2.0, line_width_2);
cairo_line_to (cr, 0, arrow_height);
cairo_close_path (cr);
@@ -1684,17 +1653,17 @@
const MurrineRGB *color,
double x, double y, double width, double height)
{
- double arrow_width = MIN (height * 2 / 3.0, width);
- double arrow_height = arrow_width / 2.0;
- double gap_size = 1.0 * arrow_height;
+ double arrow_width = MIN (height*2/3.0, width);
+ double arrow_height = arrow_width/2.0;
+ double gap_size = arrow_height;
cairo_save (cr);
- cairo_translate (cr, x, y - (arrow_height + gap_size) / 2.0);
+ cairo_translate (cr, x, y-(arrow_height+gap_size)/2.0);
cairo_rotate (cr, M_PI);
murrine_draw_normal_arrow (cr, color, 0, 0, arrow_width, arrow_height);
cairo_restore (cr);
- murrine_draw_normal_arrow (cr, color, x, y + (arrow_height + gap_size) / 2.0, arrow_width, arrow_height);
+ murrine_draw_normal_arrow (cr, color, x, y+(arrow_height+gap_size)/2.0, arrow_width, arrow_height);
}
static void
@@ -1705,16 +1674,24 @@
{
double rotate;
- if (dir == MRN_DIRECTION_LEFT)
- rotate = M_PI*1.5;
- else if (dir == MRN_DIRECTION_RIGHT)
- rotate = M_PI*0.5;
- else if (dir == MRN_DIRECTION_UP)
- rotate = M_PI;
- else if (dir == MRN_DIRECTION_DOWN)
- rotate = 0;
- else
- return;
+ switch (dir)
+ {
+ default:
+ return;
+ break;
+ case MRN_DIRECTION_LEFT:
+ rotate = M_PI*1.5;
+ break;
+ case MRN_DIRECTION_RIGHT:
+ rotate = M_PI*0.5;
+ break;
+ case MRN_DIRECTION_UP:
+ rotate = M_PI;
+ break;
+ case MRN_DIRECTION_DOWN:
+ rotate = 0;
+ break;
+ }
if (type == MRN_ARROW_NORMAL)
{
@@ -1740,8 +1717,8 @@
murrine_mix_color (&color, &colors->bg[widget->state_type], 0.2, &color);
gdouble tx, ty;
- tx = x + width/2.0;
- ty = y + height/2.0;
+ tx = x+width/2.0;
+ ty = y+height/2.0;
if (widget->disabled)
{
@@ -1757,7 +1734,7 @@
}
static void
-murrine_draw_radiobutton (cairo_t * cr,
+murrine_draw_radiobutton (cairo_t *cr,
const MurrineColors *colors,
const WidgetParameters *widget,
const CheckboxParameters *checkbox,
@@ -1793,14 +1770,14 @@
if (widget->reliefstyle > 1)
{
+ cairo_save (cr);
cairo_set_line_width (cr, 2.0);
cairo_arc (cr, 7, 7, 6, 0, M_PI*2);
murrine_set_color_rgba (cr, &shadow, 0.15);
cairo_stroke (cr);
+ cairo_restore (cr);
}
- cairo_set_line_width (cr, 1.0);
-
cairo_arc (cr, 7, 7, 5.5, 0, M_PI*2);
if (widget->state_type != GTK_STATE_INSENSITIVE)
@@ -1847,13 +1824,15 @@
{
if (inconsistent)
{
+ cairo_save (cr);
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_width (cr, 2);
+ cairo_set_line_width (cr, 2.0);
murrine_set_color_rgba (cr, dot, trans);
cairo_move_to(cr, 5, 7);
cairo_line_to(cr, 9, 7);
cairo_stroke (cr);
+ cairo_restore (cr);
}
else
{
@@ -1868,7 +1847,7 @@
}
static void
-murrine_draw_checkbox (cairo_t * cr,
+murrine_draw_checkbox (cairo_t *cr,
const MurrineColors *colors,
const WidgetParameters *widget,
const CheckboxParameters *checkbox,
@@ -1901,7 +1880,6 @@
murrine_shade (border, 0.9, &shadow);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
if (widget->xthickness > 2 && widget->ythickness > 2)
{
@@ -1965,22 +1943,24 @@
cairo_fill (cr);
}
- cairo_scale (cr, width / 13.0, height / 13.0);
+ cairo_scale (cr, width/13.0, height/13.0);
if (draw_bullet)
{
if (inconsistent) /* Inconsistent */
{
+ cairo_save (cr);
cairo_set_line_width (cr, 2.0);
cairo_move_to (cr, 3, height*0.5);
cairo_line_to (cr, width-3, height*0.5);
+ cairo_restore (cr);
}
else
{
cairo_translate (cr, -2, 0);
- /*
+ /*
if (widget && widget->parent && GTK_IS_MENU(widget->parent))
cairo_translate (cr, 0, 0);
- */
+ */
cairo_move_to (cr, 4, 8);
cairo_rel_line_to (cr, 5, 4);
cairo_rel_curve_to (cr, 1.4, -5, -1, -1, 5.7, -12.5);
@@ -2004,14 +1984,12 @@
const MurrineRGB *highlight = &colors->shade[0];
int lx, ly;
- cairo_set_line_width (cr, 1.0);
-
for (ly=0; ly<4; ly++) /* vertically, four rows of dots */
{
for (lx=0; lx<=ly; lx++) /* horizontally */
{
- int ny = (3.5-ly) * 3;
- int nx = lx * 3;
+ int ny = (3.5-ly)*3;
+ int nx = lx*3;
murrine_set_color_rgb (cr, highlight);
cairo_rectangle (cr, x+width-nx-1, y+height-ny-1, 2, 2);
Modified: trunk/src/murrine_draw_rgba.c
==============================================================================
--- trunk/src/murrine_draw_rgba.c (original)
+++ trunk/src/murrine_draw_rgba.c Fri Oct 3 10:54:33 2008
@@ -38,43 +38,43 @@
murrine_shade (bg_color, 0.4, &shadow);
/* highlight */
- cairo_move_to (cr, x + w + (radius * -0.2928932188), y - (radius * -0.2928932188));
+ cairo_move_to (cr, x+w+(radius*-0.2928932188), y-(radius*-0.2928932188));
if (corners & MRN_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.75, M_PI * 2);
+ cairo_arc (cr, x+w-radius, y+radius, radius, M_PI*1.75, M_PI*2);
else
- cairo_line_to (cr, x + w, y);
+ cairo_line_to (cr, x+w, y);
if (corners & MRN_CORNER_BOTTOMRIGHT)
- cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, M_PI * 0.5);
+ cairo_arc (cr, x+w-radius, y+h-radius, radius, 0, M_PI*0.5);
else
- cairo_line_to (cr, x + w, y + h);
+ cairo_line_to (cr, x+w, y+h);
if (corners & MRN_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.5, M_PI * 0.75);
+ cairo_arc (cr, x+radius, y+h-radius, radius, M_PI*0.5, M_PI*0.75);
else
- cairo_line_to (cr, x, y + h);
+ cairo_line_to (cr, x, y+h);
murrine_set_color_rgba (cr, &highlight, 0.48);
cairo_stroke (cr);
/* shadow */
- cairo_move_to (cr, x + (radius * 0.2928932188), y + h + (radius * -0.2928932188));
+ cairo_move_to (cr, x+(radius*0.2928932188), y+h+(radius*-0.2928932188));
if (corners & MRN_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.75, M_PI);
+ cairo_arc (cr, x+radius, y+h-radius, radius, M_PI*0.75, M_PI);
else
- cairo_line_to (cr, x, y + h);
+ cairo_line_to (cr, x, y+h);
if (corners & MRN_CORNER_TOPLEFT)
- cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
+ cairo_arc (cr, x+radius, y+radius, radius, M_PI, M_PI*1.5);
else
cairo_line_to (cr, x, y);
if (corners & MRN_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
+ cairo_arc (cr, x+w-radius, y+radius, radius, M_PI*1.5, M_PI*1.75);
else
- cairo_line_to (cr, x + w, y);
+ cairo_line_to (cr, x+w, y);
murrine_set_color_rgba (cr, &shadow, 0.12);
cairo_stroke (cr);
@@ -171,7 +171,6 @@
murrine_exchange_axis (cr, &x, &y, &width, &height);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
if (!widget->active && !widget->disabled && widget->reliefstyle > 1)
{
@@ -259,7 +258,6 @@
murrine_shade (&border, 0.92, &border);
cairo_translate (cr, x+0.5, y+0.5);
- cairo_set_line_width (cr, 1.0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -335,7 +333,7 @@
if (fill_size > width-3)
fill_size = width-3;
- fill_x = slider->inverted ? width - fill_size - 3 : 0;
+ fill_x = slider->inverted ? width-fill_size-3 : 0;
fill_y = 0;
fill_width = fill_size;
fill_height = TROUGH_SIZE-2;
@@ -343,8 +341,8 @@
trough_width = width-3;
trough_height = TROUGH_SIZE-2;
- translate_x = x + 0.5;
- translate_y = y + 0.5 + (height/2) - (TROUGH_SIZE/2);
+ translate_x = x+0.5;
+ translate_y = y+0.5+(height/2)-(TROUGH_SIZE/2);
}
else
{
@@ -352,18 +350,17 @@
fill_size = height-3;
fill_x = 0;
- fill_y = slider->inverted ? height - fill_size - 3 : 0;
+ fill_y = slider->inverted ? height-fill_size-3 : 0;
fill_width = TROUGH_SIZE-2;
fill_height = fill_size;
trough_width = TROUGH_SIZE-2;
trough_height = height-3;
- translate_x = x + 0.5 + (width/2) - (TROUGH_SIZE/2);
- translate_y = y + 0.5;
+ translate_x = x+0.5+(width/2)-(TROUGH_SIZE/2);
+ translate_y = y+0.5;
}
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, translate_x, translate_y);
if (widget->reliefstyle != 0)
@@ -393,8 +390,6 @@
murrine_shade (&widget->parentbg, 0.95, &fill);
- cairo_set_line_width (cr, 1.0);
-
/* Create trough box */
murrine_set_color_rgba (cr, &fill, 0.8);
cairo_rectangle (cr, x+1, y+1, width-2, height-2);
@@ -473,7 +468,6 @@
stroke_width = height*2;
x_step = (((float)stroke_width/10)*offset);
- cairo_set_line_width (cr, 1.0);
cairo_save (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -488,7 +482,7 @@
while (tile_pos <= width+x_step-2)
{
cairo_move_to (cr, stroke_width/2-x_step, 0);
- cairo_line_to (cr, stroke_width-x_step, 0);
+ cairo_line_to (cr, stroke_width-x_step, 0);
cairo_line_to (cr, stroke_width/2-x_step, height);
cairo_line_to (cr, -x_step, height);
@@ -582,7 +576,6 @@
cairo_pattern_destroy (pat);
int counter = -height;
- cairo_set_line_width (cr, 1.0);
murrine_shade (&low, 0.9, &low);
murrine_set_color_rgba (cr, &low, MENUBAR_STRIPED_OPACITY);
while (counter < width)
@@ -601,7 +594,6 @@
cairo_rectangle (cr, 0.5, 0.5, width-1, height-1);
else
{
- cairo_set_line_width (cr, 1.0);
cairo_move_to (cr, 0, height-0.5);
cairo_line_to (cr, width, height-0.5);
}
@@ -624,7 +616,6 @@
cairo_translate (cr, x, y);
cairo_rectangle (cr, 0, 0, width, height);
- cairo_set_line_width (cr, 1.0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
/* Glass toolbar */
@@ -680,7 +671,6 @@
cairo_rectangle (cr, 0.5, 0.5, width-1, height-1);
else
{
- cairo_set_line_width (cr, 1.0);
cairo_move_to (cr, 0, height-0.5);
cairo_line_to (cr, width, height-0.5);
}
@@ -745,7 +735,6 @@
murrine_get_frame_gap_clip (x, y, width, height,
frame, &bevel_clip, &frame_clip);
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y+0.5);
/* save everything */
@@ -821,7 +810,6 @@
if (separator->horizontal)
{
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x, y+0.5);
cairo_move_to (cr, 0.0, 0.0);
@@ -836,7 +824,6 @@
}
else
{
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y);
cairo_move_to (cr, 0.0, 0.0);
@@ -870,8 +857,6 @@
cairo_clip (cr);
cairo_new_path (cr);
- /* Translate and set line width */
- cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y+0.5);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -1066,8 +1051,6 @@
murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.95 : 1.065, &fill);
- cairo_set_line_width (cr, 1.0);
-
if (!scrollbar->horizontal)
{
cairo_translate (cr, x, y);
@@ -1110,7 +1093,7 @@
murrine_mix_color (&border_normal, fill, 0.45, &border_normal);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
+
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
/* Draw the bg */
@@ -1184,7 +1167,6 @@
width = tmp;
}
- cairo_set_line_width (cr, 1.0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
murrine_set_color_rgb (cr, &border);
@@ -1232,7 +1214,7 @@
cairo_rectangle (cr, 1, 1, width-2, height-2);
cairo_clip (cr);
cairo_new_path (cr);
- cairo_set_line_width (cr, 5); /* stroke width */
+ cairo_set_line_width (cr, 5.0); /* stroke width */
murrine_set_color_rgba (cr, &style, 0.08);
while (counter < height)
{
@@ -1263,7 +1245,7 @@
}
}
/* Draw the handle */
- if (scrollbar->style > 0 && scrollbar->style % 2 == 0 )
+ if (scrollbar->style > 0 && scrollbar->style % 2 == 0)
{
int bar_x = width/2 - 4;
cairo_translate (cr, 0.5, 0.5);
@@ -1295,7 +1277,7 @@
cairo_save (cr);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
+
cairo_rectangle (cr, 0, 0, width, height);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_fill (cr);
@@ -1332,22 +1314,20 @@
int num_bars, bar_spacing;
num_bars = 3;
bar_spacing = 3;
- bar_height = num_bars * bar_spacing;
+ bar_height = num_bars*bar_spacing;
if (handle->horizontal)
{
int tmp = height;
- rotate_mirror_translate (cr, M_PI/2, x + 0.5 + width/2 - bar_height/2, y + height/2 - bar_width/2, FALSE, FALSE);
+ rotate_mirror_translate (cr, M_PI/2, x+0.5+width/2-bar_height/2, y+height/2-bar_width/2, FALSE, FALSE);
height = width;
width = tmp;
}
else
{
- cairo_translate (cr, x + width/2 - bar_width/2, y + height/2 - bar_height/2 + 0.5);
+ cairo_translate (cr, x+width/2-bar_width/2, y+height/2-bar_height/2+0.5);
}
- cairo_set_line_width (cr, 1.0);
-
for (i=0; i<num_bars; i++)
{
murrine_set_color_rgb (cr, dark);
@@ -1361,7 +1341,7 @@
static void
-murrine_rgba_draw_radiobutton (cairo_t * cr,
+murrine_rgba_draw_radiobutton (cairo_t *cr,
const MurrineColors *colors,
const WidgetParameters *widget,
const CheckboxParameters *checkbox,
@@ -1397,14 +1377,14 @@
if (widget->reliefstyle > 1)
{
+ cairo_save (cr);
cairo_set_line_width (cr, 2.0);
cairo_arc (cr, 7, 7, 6, 0, M_PI*2);
murrine_set_color_rgba (cr, &colors->shade[8], 0.12);
cairo_stroke (cr);
+ cairo_restore (cr);
}
- cairo_set_line_width (cr, 1.0);
-
cairo_arc (cr, 7, 7, 5.5, 0, M_PI*2);
if (widget->state_type != GTK_STATE_INSENSITIVE)
@@ -1451,13 +1431,14 @@
{
if (inconsistent)
{
+ cairo_save (cr);
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_width (cr, 2);
-
+ cairo_set_line_width (cr, 2.0);
murrine_set_color_rgba (cr, dot, trans);
cairo_move_to(cr, 5, 7);
cairo_line_to(cr, 9, 7);
cairo_stroke (cr);
+ cairo_restore (cr);
}
else
{
@@ -1471,7 +1452,7 @@
}
static void
-murrine_rgba_draw_checkbox (cairo_t * cr,
+murrine_rgba_draw_checkbox (cairo_t *cr,
const MurrineColors *colors,
const WidgetParameters *widget,
const CheckboxParameters *checkbox,
@@ -1504,7 +1485,6 @@
draw_bullet ? &colors->spot[1] : &colors->bg[0] : &colors->bg[0], 0.24, &border);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
if (widget->xthickness > 2 && widget->ythickness > 2)
{
@@ -1568,14 +1548,16 @@
cairo_fill (cr);
}
- cairo_scale (cr, width / 13.0, height / 13.0);
+ cairo_scale (cr, width/13.0, height/13.0);
if (draw_bullet)
{
if (inconsistent) /* Inconsistent */
{
+ cairo_save (cr);
cairo_set_line_width (cr, 2.0);
cairo_move_to (cr, 3, height*0.5);
cairo_line_to (cr, width-3, height*0.5);
+ cairo_restore (cr);
}
else
{
@@ -1609,7 +1591,7 @@
MRN_CORNER_BOTTOMLEFT | MRN_CORNER_BOTTOMRIGHT);
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 1.0);
+
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
@@ -1646,7 +1628,6 @@
const MurrineRGB *dark = &colors->shade[4];
const MurrineRGB *highlight = &colors->shade[0];
- cairo_set_line_width (cr, 1);
cairo_translate (cr, x, y+0.5);
murrine_set_color_rgb (cr, dark);
Modified: trunk/src/murrine_rc_style.c
==============================================================================
--- trunk/src/murrine_rc_style.c (original)
+++ trunk/src/murrine_rc_style.c Fri Oct 3 10:54:33 2008
@@ -329,7 +329,7 @@
static guint
theme_parse_gradient (GtkSettings *settings,
- GScanner *scanner,
+ GScanner *scanner,
double gradient_shades[4])
{
guint token;
Modified: trunk/src/murrine_style.c
==============================================================================
--- trunk/src/murrine_style.c (original)
+++ trunk/src/murrine_style.c Fri Oct 3 10:54:33 2008
@@ -442,7 +442,6 @@
MurrineRGB *border = &colors->shade[5];
cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
murrine_set_color_rgb (cr, border);
- cairo_set_line_width (cr, 1);
cairo_stroke (cr);
}
else
@@ -896,9 +895,9 @@
slider.inverted = gtk_range_get_inverted (GTK_RANGE (widget));
slider.horizontal = (GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL);
- slider.fill_size = ((slider.horizontal ? width : height) - slider_length) *
- (1 / ((adjustment->upper - adjustment->lower) / (adjustment->value - adjustment->lower)))
- + slider_length / 2;
+ slider.fill_size = ((slider.horizontal ? width : height)-slider_length) *
+ (1/((adjustment->upper-adjustment->lower)/(adjustment->value-adjustment->lower)))
+ +slider_length/2;
if (slider.horizontal)
slider.inverted = slider.inverted != (murrine_get_direction (widget) == GTK_TEXT_DIR_RTL);
@@ -1017,11 +1016,11 @@
#ifndef HAVE_ANIMATIONRTL
STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, ¶ms, &progressbar,
x-1, y, width+2, height,
- 10 - (int)(elapsed * 10.0) % 10);
+ 10-(int)(elapsed*10.0) % 10);
#else
STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, ¶ms, &progressbar,
x-1, y, width+2, height,
- 10 + (int)(elapsed * 10.0) % 10);
+ 10+(int)(elapsed*10.0) % 10);
#endif
}
else if (DETAIL ("hscale") || DETAIL ("vscale"))
@@ -1060,9 +1059,9 @@
murrine_option_menu_get_props (widget, &indicator_size, &indicator_spacing);
if (widget && murrine_get_direction (widget) == GTK_TEXT_DIR_RTL)
- optionmenu.linepos = (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + style->xthickness;
+ optionmenu.linepos = (indicator_size.width+indicator_spacing.left+indicator_spacing.right)+style->xthickness;
else
- optionmenu.linepos = width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness;
+ optionmenu.linepos = width-(indicator_size.width+indicator_spacing.left+indicator_spacing.right)-style->xthickness;
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
@@ -1240,11 +1239,11 @@
if (DETAIL ("hseparator"))
{
gtk_paint_hline (style, window, state_type, area, widget, new_detail,
- x, x + width - 1, y + height/2);
+ x, x+width-1, y+height/2);
}
else
gtk_paint_vline (style, window, state_type, area, widget, new_detail,
- y, y + height - 1, x + width/2);
+ y, y+height-1, x+width/2);
}
else
{
@@ -1300,7 +1299,7 @@
!gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (widget)))
{
gfloat elapsed = murrine_animation_elapsed (widget);
- trans = sqrt (sqrt (MIN(elapsed / CHECK_ANIMATION_TIME, 1.0)));
+ trans = sqrt (sqrt (MIN (elapsed/CHECK_ANIMATION_TIME, 1.0)));
}
#endif
@@ -1341,7 +1340,7 @@
!gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (widget)))
{
gfloat elapsed = murrine_animation_elapsed (widget);
- trans = sqrt (sqrt (MIN(elapsed / CHECK_ANIMATION_TIME, 1.0)));
+ trans = sqrt (sqrt (MIN (elapsed/CHECK_ANIMATION_TIME, 1.0)));
}
#endif
@@ -1644,11 +1643,11 @@
else
murrine_shade (&colors->bg[widget->state], 1.2, &temp);
- etched.red = (int) (temp.r * 65535);
- etched.green = (int) (temp.g * 65535);
- etched.blue = (int) (temp.b * 65535);
+ etched.red = (int) (temp.r*65535);
+ etched.green = (int) (temp.g*65535);
+ etched.blue = (int) (temp.b*65535);
- gdk_draw_layout_with_colors (window, gc, x + 1, y + 1, layout, &etched, NULL);
+ gdk_draw_layout_with_colors (window, gc, x+1, y+1, layout, &etched, NULL);
gdk_draw_layout (window, gc, x, y, layout);
}
else
@@ -1784,7 +1783,7 @@
}
static void
-murrine_style_realize (GtkStyle * style)
+murrine_style_realize (GtkStyle *style)
{
MurrineStyle *murrine_style = MURRINE_STYLE (style);
double shades[] = {1.065, 0.95, 0.896, 0.82, 0.75, 0.665, 0.5, 0.45, 0.4};
@@ -1798,9 +1797,9 @@
contrast = MURRINE_RC_STYLE (style->rc_style)->contrast;
- bg_normal.r = style->bg[0].red / 65535.0;
- bg_normal.g = style->bg[0].green / 65535.0;
- bg_normal.b = style->bg[0].blue / 65535.0;
+ bg_normal.r = style->bg[0].red/65535.0;
+ bg_normal.g = style->bg[0].green/65535.0;
+ bg_normal.b = style->bg[0].blue/65535.0;
/* Apply contrast */
for (i = 0; i < 9; i++)
@@ -1811,9 +1810,9 @@
}
spots[2] = get_contrast(spots[2], contrast);
- spot_color.r = style->bg[GTK_STATE_SELECTED].red / 65535.0;
- spot_color.g = style->bg[GTK_STATE_SELECTED].green / 65535.0;
- spot_color.b = style->bg[GTK_STATE_SELECTED].blue / 65535.0;
+ spot_color.r = style->bg[GTK_STATE_SELECTED].red/65535.0;
+ spot_color.g = style->bg[GTK_STATE_SELECTED].green/65535.0;
+ spot_color.b = style->bg[GTK_STATE_SELECTED].blue/65535.0;
murrine_shade (&spot_color, spots[0], &murrine_style->colors.spot[0]);
murrine_shade (&spot_color, spots[1], &murrine_style->colors.spot[1]);
@@ -1852,9 +1851,9 @@
g_return_if_fail (color != NULL);
cairo_set_source_rgba (cr,
- color->red / 65535.,
- color->green / 65535.,
- color->blue / 65535.,
+ color->red/65535.,
+ color->green/65535.,
+ color->blue/65535.,
alpha);
}
@@ -1916,7 +1915,7 @@
total_length += dash_list[i];
}
- dash_offset = -line_width / 2.;
+ dash_offset = -line_width/2.;
while (dash_offset < 0)
dash_offset += total_length;
@@ -1930,7 +1929,7 @@
cairo_clip (cr);
}
- cairo_rectangle (cr, x + line_width / 2., y + line_width / 2., width - line_width, height - line_width);
+ cairo_rectangle (cr, x+line_width/2., y+line_width/2., width-line_width, height-line_width);
cairo_stroke (cr);
cairo_destroy (cr);
@@ -1939,10 +1938,10 @@
}
static void
-murrine_style_copy (GtkStyle * style, GtkStyle * src)
+murrine_style_copy (GtkStyle *style, GtkStyle *src)
{
- MurrineStyle * mrn_style = MURRINE_STYLE (style);
- MurrineStyle * mrn_src = MURRINE_STYLE (src);
+ MurrineStyle *mrn_style = MURRINE_STYLE (style);
+ MurrineStyle *mrn_src = MURRINE_STYLE (src);
mrn_style->animation = mrn_src->animation;
mrn_style->colorize_scrollbar = mrn_src->colorize_scrollbar;
@@ -1977,7 +1976,7 @@
}
static void
-murrine_style_unrealize (GtkStyle * style)
+murrine_style_unrealize (GtkStyle *style)
{
GTK_STYLE_CLASS (murrine_style_parent_class)->unrealize (style);
}
@@ -2010,8 +2009,8 @@
{
/* The "4" is the number of chars per pixel, in this case, RGBA,
the 3 means "skip to the alpha" */
- current = data + (y * rowstride) + (x * 4) + 3;
- *(current) = (guchar) (*(current) * alpha_percent);
+ current = data+(y*rowstride)+(x*4)+3;
+ *(current) = (guchar) (*(current)*alpha_percent);
}
}
@@ -2138,12 +2137,12 @@
static void
-murrine_style_init (MurrineStyle * style)
+murrine_style_init (MurrineStyle *style)
{
}
static void
-murrine_style_class_init (MurrineStyleClass * klass)
+murrine_style_class_init (MurrineStyleClass *klass)
{
GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]