diff options
author | Benjamin Otte <otte@redhat.com> | 2010-10-21 16:21:15 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-30 01:50:04 +0800 |
commit | eaf4b5a865865de7b98621a5285e16ae4dea2a61 (patch) | |
tree | ced2e8294684afe2ed71ee6eaf41a857f7fb0517 /widgets | |
parent | 168b536e82bf2cc0782e4dca9692d23200fc3a38 (diff) | |
download | gsoc2013-evolution-eaf4b5a865865de7b98621a5285e16ae4dea2a61.tar gsoc2013-evolution-eaf4b5a865865de7b98621a5285e16ae4dea2a61.tar.gz gsoc2013-evolution-eaf4b5a865865de7b98621a5285e16ae4dea2a61.tar.bz2 gsoc2013-evolution-eaf4b5a865865de7b98621a5285e16ae4dea2a61.tar.lz gsoc2013-evolution-eaf4b5a865865de7b98621a5285e16ae4dea2a61.tar.xz gsoc2013-evolution-eaf4b5a865865de7b98621a5285e16ae4dea2a61.tar.zst gsoc2013-evolution-eaf4b5a865865de7b98621a5285e16ae4dea2a61.zip |
e-text: Fix color handling
- "color" and "color-gdk" properties aren't readable (Their values would
be wrong if an alpha channel was set).
- Use the rgba color when rendering
- Don't allocate the color in the colormap anymore.
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/text/e-text.c | 37 | ||||
-rw-r--r-- | widgets/text/e-text.h | 3 |
2 files changed, 13 insertions, 27 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 9ddfc626e9..593ef8d6ab 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -615,7 +615,6 @@ e_text_set_property (GObject *object, EText *text; GdkColor color = { 0, 0, 0, 0, }; GdkColor *pcolor; - gboolean color_changed; gboolean needs_update = 0; gboolean needs_reflow = 0; @@ -623,8 +622,6 @@ e_text_set_property (GObject *object, item = GNOME_CANVAS_ITEM (object); text = E_TEXT (object); - color_changed = FALSE; - switch (prop_id) { case PROP_MODEL: @@ -771,7 +768,8 @@ e_text_set_property (GObject *object, (color.green & 0xff00) << 8 | (color.blue & 0xff00) | 0xff); - color_changed = TRUE; + text->needs_redraw = 1; + needs_update = 1; break; case PROP_FILL_COLOR_GDK: @@ -784,7 +782,8 @@ e_text_set_property (GObject *object, (color.green & 0xff00) << 8 | (color.blue & 0xff00) | 0xff); - color_changed = TRUE; + text->needs_redraw = 1; + needs_update = 1; break; case PROP_FILL_COLOR_RGBA: @@ -792,7 +791,8 @@ e_text_set_property (GObject *object, color.red = ((text->rgba >> 24) & 0xff) * 0x101; color.green = ((text->rgba >> 16) & 0xff) * 0x101; color.blue = ((text->rgba >> 8) & 0xff) * 0x101; - color_changed = TRUE; + text->needs_redraw = 1; + needs_update = 1; break; case PROP_EDITABLE: @@ -924,17 +924,6 @@ e_text_set_property (GObject *object, return; } - if (color_changed) { - GdkColormap *colormap = gtk_widget_get_colormap ( - GTK_WIDGET (item->canvas)); - - text->color = color; - gdk_rgb_find_color (colormap, &text->color); - - text->needs_redraw = 1; - needs_update = 1; - } - if (needs_reflow) e_canvas_item_request_reflow (item); if (needs_update) @@ -1002,10 +991,6 @@ e_text_get_property (GObject *object, g_value_set_double (value, text->yofs); break; - case PROP_FILL_COLOR_GDK: - g_value_set_boxed (value, &text->color); - break; - case PROP_FILL_COLOR_RGBA: g_value_set_uint (value, text->rgba); break; @@ -1308,7 +1293,11 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, if (text->draw_background || text->draw_button) { gdk_cairo_set_source_color (cr, &style->fg[state]); } else { - gdk_cairo_set_source_color (cr, &text->color); + cairo_set_source_rgba (cr, + ((text->rgba >> 24) & 0xff) / 255.0, + ((text->rgba >> 16) & 0xff) / 255.0, + ((text->rgba >> 8) & 0xff) / 255.0, + ( text->rgba & 0xff) / 255.0); } if (text->draw_borders || text->draw_background) { @@ -3242,14 +3231,14 @@ e_text_class_init (ETextClass *klass) "Fill color", "Fill color", NULL, - G_PARAM_READWRITE)); + G_PARAM_READABLE)); g_object_class_install_property (gobject_class, PROP_FILL_COLOR_GDK, g_param_spec_boxed ("fill_color_gdk", "GDK fill color", "GDK fill color", GDK_TYPE_COLOR, - G_PARAM_READWRITE)); + G_PARAM_READABLE)); g_object_class_install_property (gobject_class, PROP_FILL_COLOR_RGBA, g_param_spec_uint ("fill_color_rgba", diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h index 6cc47b5b1a..ef9aefdf34 100644 --- a/widgets/text/e-text.h +++ b/widgets/text/e-text.h @@ -119,8 +119,6 @@ struct _EText { gdouble xofs, yofs; /* Text offset distance from anchor position */ - GdkColor color; /* Fill color */ - gint cx, cy; /* Top-left canvas coordinates for text */ gint text_cx, text_cy; /* Top-left canvas coordinates for text */ gint clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */ @@ -130,7 +128,6 @@ struct _EText { gint height; /* Rendered text height in pixels */ guint32 rgba; /* RGBA color for text */ - gdouble affine[6]; /* The item -> canvas affine */ gchar *ellipsis; /* The ellipsis characters. NULL = "...". */ gdouble ellipsis_width; /* The width of the ellipsis. */ |