summaryrefslogtreecommitdiff
path: root/draw
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-07-08 22:32:24 +0200
committerTor Andersson <tor@ghostscript.com>2010-07-08 22:32:24 +0200
commit3a4c396334bc500de4c9b1e957f030835b5df65e (patch)
treec6971cea67729ac9d95aeceed172050db3444f0e /draw
parent839eda4994874c02cbaf546a40d374a4edb16539 (diff)
downloadmupdf-3a4c396334bc500de4c9b1e957f030835b5df65e.tar.xz
Simplify #ifdef labyrinth and make some source more c89 compatible.
Diffstat (limited to 'draw')
-rw-r--r--draw/blendmodes.c5
-rw-r--r--draw/pathscan.c19
2 files changed, 15 insertions, 9 deletions
diff --git a/draw/blendmodes.c b/draw/blendmodes.c
index 973d79ab..f86fa1ef 100644
--- a/draw/blendmodes.c
+++ b/draw/blendmodes.c
@@ -150,8 +150,11 @@ sat(int r, int g, int b)
static void
setsat(int r, int g, int b, int s, int *dr, int *dg, int *db)
{
- int *m[3] = { &r, &g, &b }; /* min, med, max */
+ int *m[3]; /* min, med, max */
int *t;
+ m[0] = &r;
+ m[1] = &g;
+ m[2] = &b;
#define SWAP(a, b) (t = a, a = b, b = t)
if (*m[0] > *m[1])
SWAP(m[0], m[1]);
diff --git a/draw/pathscan.c b/draw/pathscan.c
index f0b17e6a..fa3a6e92 100644
--- a/draw/pathscan.c
+++ b/draw/pathscan.c
@@ -1,5 +1,8 @@
#include "fitz.h"
+#define BBOX_MIN -(1<<20)
+#define BBOX_MAX (1<<20)
+
/* divide and floor towards -inf */
static inline int fz_idiv(int a, int b)
{
@@ -26,11 +29,11 @@ fz_newgel(void)
gel->len = 0;
gel->edges = fz_malloc(sizeof(fz_edge) * gel->cap);
- gel->clip.x0 = gel->clip.y0 = INT_MAX;
- gel->clip.x1 = gel->clip.y1 = INT_MIN;
+ gel->clip.x0 = gel->clip.y0 = BBOX_MAX;
+ gel->clip.x1 = gel->clip.y1 = BBOX_MIN;
- gel->bbox.x0 = gel->bbox.y0 = INT_MAX;
- gel->bbox.x1 = gel->bbox.y1 = INT_MIN;
+ gel->bbox.x0 = gel->bbox.y0 = BBOX_MAX;
+ gel->bbox.x1 = gel->bbox.y1 = BBOX_MIN;
return gel;
}
@@ -40,8 +43,8 @@ fz_resetgel(fz_gel *gel, fz_bbox clip)
{
if (fz_isinfiniterect(clip))
{
- gel->clip.x0 = gel->clip.y0 = INT_MAX;
- gel->clip.x1 = gel->clip.y1 = INT_MIN;
+ gel->clip.x0 = gel->clip.y0 = BBOX_MAX;
+ gel->clip.x1 = gel->clip.y1 = BBOX_MIN;
}
else {
gel->clip.x0 = clip.x0 * HSCALE;
@@ -50,8 +53,8 @@ fz_resetgel(fz_gel *gel, fz_bbox clip)
gel->clip.y1 = clip.y1 * VSCALE;
}
- gel->bbox.x0 = gel->bbox.y0 = INT_MAX;
- gel->bbox.x1 = gel->bbox.y1 = INT_MIN;
+ gel->bbox.x0 = gel->bbox.y0 = BBOX_MAX;
+ gel->bbox.x1 = gel->bbox.y1 = BBOX_MIN;
gel->len = 0;
}