[gnumeric] Rendered value: slim dowm the rotated structure.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Rendered value: slim dowm the rotated structure.
- Date: Sat, 7 Jan 2012 00:12:43 +0000 (UTC)
commit 1322fc8ac21dfb8eecbd76c427a71158513d7616
Author: Morten Welinder <terra gnome org>
Date: Fri Jan 6 19:12:06 2012 -0500
Rendered value: slim dowm the rotated structure.
ChangeLog | 3 +++
src/cell-draw.c | 3 +--
src/rendered-value.c | 13 +++++++------
src/rendered-value.h | 2 +-
4 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b5ccaa8..e3ee906 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2012-01-06 Morten Welinder <terra gnome org>
+ * src/rendered-value.h (GnmRenderedRotatedValue): Storing six
+ double when all we need is a bit is overkill.
+
* src/cell-draw.c (cell_draw): Clean out old code.
2012-01-05 Morten Welinder <terra gnome org>
diff --git a/src/cell-draw.c b/src/cell-draw.c
index ef6ee80..d41db50 100644
--- a/src/cell-draw.c
+++ b/src/cell-draw.c
@@ -107,8 +107,7 @@ cell_calc_layout (G_GNUC_UNUSED GnmCell const *cell, GnmRenderedValue *rv, int y
if (rv->rotation && !rv->noborders) {
GnmRenderedRotatedValue const *rrv = (GnmRenderedRotatedValue *)rv;
- double sin_a = rrv->rotmat.xy;
- if (sin_a < 0) {
+ if (rrv->sin_a_neg) {
hoffset += (width - indent) - rv->layout_natural_width;
}
} else if (!rv->rotation && rv->wrap_text
diff --git a/src/rendered-value.c b/src/rendered-value.c
index 973b35b..7fcbaf0 100644
--- a/src/rendered-value.c
+++ b/src/rendered-value.c
@@ -91,11 +91,15 @@ gnm_rendered_value_remeasure (GnmRenderedValue *rv)
PangoLayoutIter *iter;
int l = 0;
int lwidth;
+ PangoMatrix rotmat = PANGO_MATRIX_INIT;
- sin_a = rrv->rotmat.xy;
+ pango_matrix_rotate (&rotmat, rv->rotation);
+
+ sin_a = rotmat.xy;
+ rrv->sin_a_neg = (sin_a < 0);
abs_sin_a = fabs (sin_a);
- cos_a = rrv->rotmat.xx;
- pango_context_set_matrix (context, &rrv->rotmat);
+ cos_a = rotmat.xx;
+ pango_context_set_matrix (context, &rotmat);
pango_layout_context_changed (rv->layout);
rrv->linecount = pango_layout_get_line_count (rv->layout);
@@ -248,15 +252,12 @@ gnm_rendered_value_new (GnmCell const *cell,
rotation = gnm_style_get_rotation (mstyle);
if (rotation) {
- static PangoMatrix const id = PANGO_MATRIX_INIT;
GnmRenderedRotatedValue *rrv;
GnmStyleElement e;
rrv = CHUNK_ALLOC (GnmRenderedRotatedValue, rendered_rotated_value_pool);
res = &rrv->rv;
- rrv->rotmat = id;
- pango_matrix_rotate (&rrv->rotmat, rotation);
rrv->linecount = 0;
rrv->lines = NULL;
diff --git a/src/rendered-value.h b/src/rendered-value.h
index 01b2300..9eb30f3 100644
--- a/src/rendered-value.h
+++ b/src/rendered-value.h
@@ -33,7 +33,7 @@ struct _GnmRenderedValue {
struct _GnmRenderedRotatedValue {
GnmRenderedValue rv;
- PangoMatrix rotmat;
+ guint sin_a_neg : 1;
int linecount;
struct GnmRenderedRotatedValueInfo {
int dx, dy;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]