diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-11-16 08:58:17 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-11-16 08:58:17 +0100 |
commit | 3b425b8bf0c58e25da576ed86496171ea19240f9 (patch) | |
tree | 37d6feb715dd929392fb16fdde6cf994dfbc1397 /render/edgelist.c | |
parent | 49132f70ac40b2dc7b9a0e22b33a3964af687874 (diff) | |
download | mupdf-3b425b8bf0c58e25da576ed86496171ea19240f9.tar.xz |
removed c99-isms. improved bbox handling.
Diffstat (limited to 'render/edgelist.c')
-rw-r--r-- | render/edgelist.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/render/edgelist.c b/render/edgelist.c index 9bcc92b1..7b39ae70 100644 --- a/render/edgelist.c +++ b/render/edgelist.c @@ -52,10 +52,22 @@ fz_dropgel(fz_gel *gel) fz_free(gel); } +fz_irect +fz_boundgel(fz_gel *gel) +{ + fz_irect bbox; + bbox.min.x = fz_idiv(gel->xmin, gel->hs); + bbox.min.y = fz_idiv(gel->ymin, gel->vs); + bbox.max.x = fz_idiv(gel->xmax, gel->hs) + 1; + bbox.max.y = fz_idiv(gel->ymax, gel->vs) + 1; + return bbox; +} + fz_error * fz_insertgel(fz_gel *gel, float fx0, float fy0, float fx1, float fy1) { fz_edge *edge; + int x0, y0, x1, y1; int dx, dy; int winding; int width; @@ -67,10 +79,10 @@ fz_insertgel(fz_gel *gel, float fx0, float fy0, float fx1, float fy1) fy1 *= gel->vs; /* TODO: should we round or truncate? */ - int x0 = fx0 < 0 ? fx0 - 0.5 : fx0 + 0.5; - int y0 = fy0 < 0 ? fy0 - 0.5 : fy0 + 0.5; - int x1 = fx1 < 0 ? fx1 - 0.5 : fx1 + 0.5; - int y1 = fy1 < 0 ? fy1 - 0.5 : fy1 + 0.5; + x0 = fx0 < 0 ? fx0 - 0.5 : fx0 + 0.5; + y0 = fy0 < 0 ? fy0 - 0.5 : fy0 + 0.5; + x1 = fx1 < 0 ? fx1 - 0.5 : fx1 + 0.5; + y1 = fy1 < 0 ? fy1 - 0.5 : fy1 + 0.5; if (y0 == y1) return nil; |