[gnumeric] fix performance issue bug #656669
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] fix performance issue bug #656669
- Date: Thu, 18 Aug 2011 03:22:50 +0000 (UTC)
commit 942eb7af132e3c9f417e48257955417dea8984af
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Aug 17 21:20:28 2011 -0600
fix performance issue bug #656669
2011-08-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/rendered-value.h (_GnmRenderedValue): re-add color field
* src/rendered-value.c (gnm_rendered_value_new): store style color
in color field
(colour_selector_cb): deleted
(colour_from_layout): deleted
(gnm_rendered_value_get_color): just return color field value
ChangeLog | 9 +++++++++
src/cell-draw.c | 2 +-
src/rendered-value.c | 45 +++++----------------------------------------
src/rendered-value.h | 2 ++
4 files changed, 17 insertions(+), 41 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ed39c57..c292d20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-08-17 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/rendered-value.h (_GnmRenderedValue): re-add color field
+ * src/rendered-value.c (gnm_rendered_value_new): store style color
+ in color field
+ (colour_selector_cb): deleted
+ (colour_from_layout): deleted
+ (gnm_rendered_value_get_color): just return color field value
+
2011-08-11 Jean Brefort <jean brefort normalesup org>
* src/sheet-control-gui.c (sheet_object_key_pressed),
diff --git a/src/cell-draw.c b/src/cell-draw.c
index a67d5a6..38d882d 100644
--- a/src/cell-draw.c
+++ b/src/cell-draw.c
@@ -47,7 +47,7 @@ static char const hashes[] =
* <= 0 will use width / 2
*/
gboolean
-cell_calc_layout (GnmCell const *cell, GnmRenderedValue *rv, int y_direction,
+cell_calc_layout (G_GNUC_UNUSED GnmCell const *cell, GnmRenderedValue *rv, int y_direction,
int width, int height, int h_center,
GOColor *res_color, gint *res_x, gint *res_y)
{
diff --git a/src/rendered-value.c b/src/rendered-value.c
index 1579bd3..7f7e11b 100644
--- a/src/rendered-value.c
+++ b/src/rendered-value.c
@@ -186,7 +186,6 @@ gnm_rendered_value_new (GnmCell const *cell,
GnmStyle const *mstyle;
PangoDirection dir;
char const *text;
- PangoAttribute *attr;
g_return_val_if_fail (cell != NULL, NULL);
@@ -284,16 +283,13 @@ gnm_rendered_value_new (GnmCell const *cell,
}
}
- /* Add foreground color. */
- attr = go_color_to_pango
- ((gnm_style_get_font_color (mstyle))->go_color, TRUE);
- attr->start_index = 0;
- attr->end_index = G_MAXUINT;
- pango_attr_list_insert_before (attrs, attr);
-
pango_layout_set_attributes (res->layout, attrs);
pango_attr_list_unref (attrs);
+ /* Store foreground color. */
+ /* Wrapping this colour around the attribute list drops performance! */
+ res->go_fore_color = (gnm_style_get_font_color (mstyle))->go_color;
+
/* ---------------------------------------- */
/*
@@ -526,41 +522,10 @@ gnm_rendered_value_get_text (GnmRenderedValue const *rv)
return pango_layout_get_text (rv->layout);
}
-static gboolean
-colour_selector_cb (PangoAttribute *attribute, PangoColor *color)
-{
- if (attribute->start_index == 0 &&
- PANGO_ATTR_FOREGROUND == attribute->klass->type) {
- *color = ((PangoAttrColor *)(attribute))->color;
- return FALSE;
- }
- return FALSE;
-}
-
-static GOColor
-colour_from_layout (PangoLayout *layout)
-{
- PangoAttrList *attrs = pango_layout_get_attributes (layout),
- *fattrs;
- PangoColor c;
-
- if (go_pango_attr_list_is_empty (attrs))
- return 0;
-
- fattrs = pango_attr_list_filter
- (attrs, (PangoAttrFilterFunc)colour_selector_cb, &c);
-
- if (fattrs == NULL)
- return 0;
- pango_attr_list_unref (fattrs);
-
- return GO_COLOR_FROM_RGBA (c.red, c.green, c.blue, 0xff);
-}
-
GOColor
gnm_rendered_value_get_color (GnmRenderedValue const * rv)
{
- return colour_from_layout (rv->layout);
+ return rv->go_fore_color;;
}
/* ------------------------------------------------------------------------- */
diff --git a/src/rendered-value.h b/src/rendered-value.h
index bac1501..01b2300 100644
--- a/src/rendered-value.h
+++ b/src/rendered-value.h
@@ -16,6 +16,8 @@ struct _GnmRenderedValue {
/* In pixels: */
guint16 indent_left, indent_right;
+ GOColor go_fore_color;
+
guint effective_halign : 8;
guint effective_valign : 5;
guint variable_width : 1; /* result depends on the width of cell */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]