aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-08-02 15:37:17 +0800
committerMilan Crha <mcrha@redhat.com>2012-08-02 15:38:09 +0800
commit9c2a94b367553d79add31c3beea0a86df2ff1f1d (patch)
tree32697b7396da729ba6060ac8177e8ddb93fa4243 /e-util
parent3d6132078568651c7756093a44242856d4ff6b5f (diff)
downloadgsoc2013-evolution-9c2a94b367553d79add31c3beea0a86df2ff1f1d.tar
gsoc2013-evolution-9c2a94b367553d79add31c3beea0a86df2ff1f1d.tar.gz
gsoc2013-evolution-9c2a94b367553d79add31c3beea0a86df2ff1f1d.tar.bz2
gsoc2013-evolution-9c2a94b367553d79add31c3beea0a86df2ff1f1d.tar.lz
gsoc2013-evolution-9c2a94b367553d79add31c3beea0a86df2ff1f1d.tar.xz
gsoc2013-evolution-9c2a94b367553d79add31c3beea0a86df2ff1f1d.tar.zst
gsoc2013-evolution-9c2a94b367553d79add31c3beea0a86df2ff1f1d.zip
Make e_color_to_value() use e_rgba_to_value()
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-util.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 2f84c34d9e..a2221a332a 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -822,17 +822,16 @@ e_int_compare (gconstpointer x,
guint32
e_color_to_value (GdkColor *color)
{
- guint16 red;
- guint16 green;
- guint16 blue;
+ GdkRGBA rgba;
g_return_val_if_fail (color != NULL, 0);
- red = color->red >> 8;
- green = color->green >> 8;
- blue = color->blue >> 8;
+ rgba.red = color->red / 65535.0;
+ rgba.green = color->green / 65535.0;
+ rgba.blue = color->blue / 65535.0;
+ rgba.alpha = 0.0;
- return (guint32) (((red << 16) | (green << 8) | blue) & 0xffffff);
+ return e_rgba_to_value (&rgba);
}
/**
@@ -853,11 +852,11 @@ e_rgba_to_value (GdkRGBA *rgba)
g_return_val_if_fail (rgba != NULL, 0);
- red = ((guint16) (G_MAXUINT16 * rgba->red)) >> 8;
- green = ((guint16) (G_MAXUINT16 * rgba->green)) >> 8;
- blue = ((guint16) (G_MAXUINT16 * rgba->blue)) >> 8;
+ red = 255 * rgba->red;
+ green = 255 * rgba->green;
+ blue = 255 * rgba->blue;
- return (guint32) (((red << 16) | (green << 8) | blue) & 0xffffff);
+ return (guint32) ((((red & 0xFF) << 16) | ((green & 0xFF) << 8) | (blue & 0xFF)) & 0xffffff);
}
static gint