summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2011-02-04 13:16:59 +0000
committerTor Andersson <tor@ghostscript.com>2011-02-04 13:16:59 +0000
commit3b743617195cfb0bbd4feabbb8505feb66e48a5a (patch)
tree06efe66b5622243bdbced50061d64dcfa2cb534c /fitz
parentc8afc0650a926f06377de613dfe7b99f6a6427b8 (diff)
downloadmupdf-3b743617195cfb0bbd4feabbb8505feb66e48a5a.tar.xz
Compensate for floating point imprecision in roundrect.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/base_geometry.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fitz/base_geometry.c b/fitz/base_geometry.c
index 375de12d..311221e0 100644
--- a/fitz/base_geometry.c
+++ b/fitz/base_geometry.c
@@ -143,10 +143,10 @@ fz_bbox
fz_roundrect(fz_rect f)
{
fz_bbox i;
- i.x0 = floorf(f.x0);
- i.y0 = floorf(f.y0);
- i.x1 = ceilf(f.x1);
- i.y1 = ceilf(f.y1);
+ i.x0 = floorf(f.x0 + 0.001f); /* adjust by 0.001 to compensate for precision errors */
+ i.y0 = floorf(f.y0 + 0.001f);
+ i.x1 = ceilf(f.x1 - 0.001f);
+ i.y1 = ceilf(f.y1 - 0.001f);
return i;
}