summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-20 09:24:27 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-20 09:24:27 -0300
commit88e85d414446090084b121f01372946cb16bbf99 (patch)
tree64557e3dff5221834d1b6172c3830fbd3bcc362f /gfx
parent656106975a0571a424c4bb3a8c184cd3ce2788de (diff)
downloadeeshow-88e85d414446090084b121f01372946cb16bbf99.tar.gz
eeshow-88e85d414446090084b121f01372946cb16bbf99.tar.bz2
eeshow-88e85d414446090084b121f01372946cb16bbf99.zip
eeshow/gfx/cro.c (cr_text_width): use cd/dc, not cx/xc
We don't want to risk getting sheet offsets mixed into our text sizes.
Diffstat (limited to 'gfx')
-rw-r--r--gfx/cro.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index 1cbfdfa..317ff10 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -66,15 +66,15 @@ static inline int cd(const struct cro_ctx *cc, int x)
}
-static inline int cx(const struct cro_ctx *cc, int x)
+static inline int dc(const struct cro_ctx *cc, int x)
{
- return cc->xo + (x + cc->xe) * cc->scale;
+ return x / cc->scale;
}
-static inline int xc(const struct cro_ctx *cc, int x)
+static inline int cx(const struct cro_ctx *cc, int x)
{
- return (x - cc->xo) / cc->scale - cc->xe;
+ return cc->xo + (x + cc->xe) * cc->scale;
}
@@ -230,9 +230,9 @@ static unsigned cr_text_width(void *ctx, const char *s, unsigned size)
struct cro_ctx *cc = ctx;
cairo_text_extents_t ext;
- cairo_set_font_size(cc->cr, cx(cc, size) * TEXT_STRETCH);
+ cairo_set_font_size(cc->cr, cd(cc, size) * TEXT_STRETCH);
cairo_text_extents(cc->cr, s, &ext);
- return xc(cc, ext.width) * 1.05; /* @@@ Cairo seems to underestimate */
+ return dc(cc, ext.width) * 1.05; /* @@@ Cairo seems to underestimate */
}