[murrine] Better handling of the border_shade: max allowed value is 2
- From: Andrea Cimitan <acimitan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [murrine] Better handling of the border_shade: max allowed value is 2
- Date: Tue, 8 Dec 2009 15:21:14 +0000 (UTC)
commit 9fc0deb72d6053339bc12a7db545d85307a6229d
Author: Andrea Cimitan <andrea cimitan gmail com>
Date: Wed Sep 16 19:34:47 2009 +0200
Better handling of the border_shade: max allowed value is 2
src/cairo-support.c | 9 +++++++++
src/cairo-support.h | 2 ++
src/murrine_draw.c | 10 +++++-----
3 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/cairo-support.c b/src/cairo-support.c
index aac4ae8..8488ab9 100644
--- a/src/cairo-support.c
+++ b/src/cairo-support.c
@@ -959,6 +959,15 @@ get_contrast (double old, double factor)
}
}
+double
+get_inverted_shade (double old)
+{
+ if (old == 1.0)
+ return old;
+
+ return CLAMP (2.0-old, 0.0, 2.0);
+}
+
MurrineGradients
get_decreased_gradient_shades (MurrineGradients mrn_gradient, double factor)
{
diff --git a/src/cairo-support.h b/src/cairo-support.h
index 8d59013..2f5fef8 100644
--- a/src/cairo-support.h
+++ b/src/cairo-support.h
@@ -55,6 +55,8 @@ G_GNUC_INTERNAL double get_decreased_shade (double old, double factor);
G_GNUC_INTERNAL double get_increased_shade (double old, double factor);
+G_GNUC_INTERNAL double get_inverted_shade (double old);
+
G_GNUC_INTERNAL double get_contrast (double old, double factor);
G_GNUC_INTERNAL MurrineGradients get_decreased_gradient_shades (MurrineGradients mrn_gradient, double factor);
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index 3d35b2c..8e4b338 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -160,9 +160,9 @@ murrine_draw_button (cairo_t *cr,
if (widget->disabled)
{
mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 3.0);
+ border_shade_custom = get_decreased_shade (widget->border_shade, 2.0);
glow_shade_custom = get_decreased_shade (widget->glow_shade, 2.0);
highlight_shade_custom = get_decreased_shade (widget->highlight_shade, 2.0);
- border_shade_custom = get_decreased_shade (widget->border_shade, 2.0);
lightborder_shade_custom = get_decreased_shade (widget->lightborder_shade, 2.0);
}
else
@@ -190,7 +190,7 @@ murrine_draw_button (cairo_t *cr,
}
else if (widget->reliefstyle != 0 && xos >= 0.5 && yos >= 0.5)
{
- border_shade_custom = 1.0+fabs(1.0-border_shade_custom);
+ border_shade_custom = get_inverted_shade (border_shade_custom);
murrine_draw_inset (cr, &widget->parentbg, xos-0.5, yos-0.5,
width-(xos*2)+1, height-(yos*2)+1,
widget->roundness+1, widget->corners);
@@ -301,7 +301,7 @@ murrine_draw_entry (cairo_t *cr,
murrine_draw_border (cr, &border,
1, 1, width-3, height-3,
radius, widget->corners,
- 1.0+fabs(1.0-widget->border_shade), 1.0);
+ get_inverted_shade(widget->border_shade), 1.0);
}
static void
@@ -2022,7 +2022,7 @@ murrine_draw_radiobutton (cairo_t *cr,
1.5, 1.5, width-3, height-3,
roundness, widget->corners,
checkbox->in_menu || checkbox->in_cell ? 1.0 : draw_bullet ?
- widget->border_shade : 1.0+fabs(1.0-widget->border_shade), 1.0);
+ widget->border_shade : get_inverted_shade(widget->border_shade), 1.0);
if (draw_bullet)
{
@@ -2134,7 +2134,7 @@ murrine_draw_checkbox (cairo_t *cr,
1.5, 1.5, width-3, height-3,
roundness, widget->corners,
checkbox->in_menu || checkbox->in_cell ? 1.0 : draw_bullet ?
- widget->border_shade : 1.0+fabs(1.0-widget->border_shade), 1.0);
+ widget->border_shade : get_inverted_shade(widget->border_shade), 1.0);
if (draw_bullet)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]