summaryrefslogtreecommitdiff
path: root/gfx/cro.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-23 18:12:44 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-23 18:20:45 -0300
commitff75c07423e278ae0e2c6effe4bde1a4fc19965f (patch)
tree3caeabe6618a624e4f87f0d95c41f6f0a3460bb6 /gfx/cro.c
parentc2de063fc1c4a0816984588db335e20cd4446fe1 (diff)
downloadeeshow-ff75c07423e278ae0e2c6effe4bde1a4fc19965f.tar.gz
eeshow-ff75c07423e278ae0e2c6effe4bde1a4fc19965f.tar.bz2
eeshow-ff75c07423e278ae0e2c6effe4bde1a4fc19965f.zip
gfx/cro.c: use "double" for coordinate conversions
This has a number of amazing effects: - font over-sizing issues almost completely disappear (they can still get a bit too small( - PDFs no longer show rounding effects at default scale Drawback: - there is now more anti-aliasing, making things look slightly blurred
Diffstat (limited to 'gfx/cro.c')
-rw-r--r--gfx/cro.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index af5faf5..903126d 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -63,25 +63,25 @@ struct cro_ctx {
};
-static inline int cd(const struct cro_ctx *cc, int x)
+static inline double cd(const struct cro_ctx *cc, int x)
{
return x * cc->scale;
}
-static inline int dc(const struct cro_ctx *cc, int x)
+static inline double dc(const struct cro_ctx *cc, double x)
{
return x / cc->scale;
}
-static inline int cx(const struct cro_ctx *cc, int x)
+static inline double cx(const struct cro_ctx *cc, int x)
{
return cc->xo + x * cc->scale;
}
-static inline int cy(const struct cro_ctx *cc, int y)
+static inline double cy(const struct cro_ctx *cc, int y)
{
return cc->yo + y * cc->scale;
}
@@ -235,7 +235,7 @@ static unsigned cr_text_width(void *ctx, const char *s, unsigned size)
cairo_set_font_size(cc->cr, cd(cc, size) * TEXT_STRETCH);
cairo_text_extents(cc->cr, s, &ext);
- return dc(cc, ext.width) * 1.05; /* @@@ Cairo seems to underestimate */
+ return dc(cc, ext.width);
}
@@ -457,7 +457,6 @@ static void cr_pdf_end(void *ctx)
if (cc->toc)
pdftoc_end(cc->toc);
-
}