summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-09-02 01:32:45 +0200
committerTor Andersson <tor@ghostscript.com>2008-09-02 01:32:45 +0200
commit98a12532a6df4cf6f13d109e93e3e236bf3489a4 (patch)
tree83ce8b9cd02d672bd03776bb40c56c0323b99e3b
parent0f168c6810aa8f031fe546312fda81e274c9be80 (diff)
downloadmupdf-98a12532a6df4cf6f13d109e93e3e236bf3489a4.tar.xz
Use unsigned char type for coverage calculations to keep the value inside the ring 0..255. This fixes a leaking pixel bug when drawing alpha blended paths.
-rw-r--r--include/fitz/draw_misc.h6
-rw-r--r--raster/pathscan.c2
-rw-r--r--raster/porterduff.c12
3 files changed, 10 insertions, 10 deletions
diff --git a/include/fitz/draw_misc.h b/include/fitz/draw_misc.h
index fe25b956..3eeefcfb 100644
--- a/include/fitz/draw_misc.h
+++ b/include/fitz/draw_misc.h
@@ -23,9 +23,9 @@ extern void (*fz_duff_4i1c4)(FZ_BYTE*,int,FZ_BYTE*,int,FZ_BYTE*,int,int,int);
extern void (*fz_duff_1i1o1)(FZ_BYTE*,int,FZ_BYTE*,int,FZ_BYTE*,int,int,int);
extern void (*fz_duff_4i1o4)(FZ_BYTE*,int,FZ_BYTE*,int,FZ_BYTE*,int,int,int);
-extern void (*fz_path_1c1)(FZ_BYTE*,int,int,FZ_BYTE*);
-extern void (*fz_path_1o1)(FZ_BYTE*,int,int,FZ_BYTE*);
-extern void (*fz_path_w4i1o4)(FZ_BYTE*,FZ_BYTE*,int,int,FZ_BYTE*);
+extern void (*fz_path_1c1)(FZ_BYTE*,unsigned char,int,FZ_BYTE*);
+extern void (*fz_path_1o1)(FZ_BYTE*,unsigned char,int,FZ_BYTE*);
+extern void (*fz_path_w4i1o4)(FZ_BYTE*,FZ_BYTE*,unsigned char,int,FZ_BYTE*);
extern void (*fz_text_1c1)(FZ_BYTE*,int,FZ_BYTE*,int,int,int);
extern void (*fz_text_1o1)(FZ_BYTE*,int,FZ_BYTE*,int,int,int);
diff --git a/raster/pathscan.c b/raster/pathscan.c
index 67ff0456..0ea46502 100644
--- a/raster/pathscan.c
+++ b/raster/pathscan.c
@@ -432,7 +432,7 @@ static inline void blit(fz_pixmap *pix, int x, int y,
unsigned char *argb, int over)
{
unsigned char *dst;
- int cov;
+ unsigned char cov;
dst = pix->samples + ( (y - pix->y) * pix->w + (x - pix->x) ) * pix->n;
cov = 0;
diff --git a/raster/porterduff.c b/raster/porterduff.c
index e9aa6307..8f2b9862 100644
--- a/raster/porterduff.c
+++ b/raster/porterduff.c
@@ -238,7 +238,7 @@ static void duff_4i1o4(byte * restrict sp0, int sw, byte * restrict mp0, int mw,
* Path and text masks
*/
-static void path_1c1(byte * restrict src, int cov, int len, byte * restrict dst)
+static void path_1c1(byte * restrict src, byte cov, int len, byte * restrict dst)
{
while (len--)
{
@@ -247,7 +247,7 @@ static void path_1c1(byte * restrict src, int cov, int len, byte * restrict dst)
}
}
-static void path_1o1(byte * restrict src, int cov, int len, byte * restrict dst)
+static void path_1o1(byte * restrict src, byte cov, int len, byte * restrict dst)
{
while (len--)
{
@@ -258,7 +258,7 @@ static void path_1o1(byte * restrict src, int cov, int len, byte * restrict dst)
}
// With 4 In 1 Over 4
-static void path_w4i1o4(byte * restrict argb, byte * restrict src, int cov, int len, byte * restrict dst)
+static void path_w4i1o4(byte * restrict argb, byte * restrict src, byte cov, int len, byte * restrict dst)
{
byte alpha = argb[0];
byte r = argb[4];
@@ -351,9 +351,9 @@ void (*fz_duff_4i1c4)(byte*,int,byte*,int,byte*,int,int,int) = duff_4i1c4;
void (*fz_duff_1i1o1)(byte*,int,byte*,int,byte*,int,int,int) = duff_1i1o1;
void (*fz_duff_4i1o4)(byte*,int,byte*,int,byte*,int,int,int) = duff_4i1o4;
-void (*fz_path_1c1)(byte*,int,int,byte*) = path_1c1;
-void (*fz_path_1o1)(byte*,int,int,byte*) = path_1o1;
-void (*fz_path_w4i1o4)(byte*,byte*,int,int,byte*) = path_w4i1o4;
+void (*fz_path_1c1)(byte*,byte,int,byte*) = path_1c1;
+void (*fz_path_1o1)(byte*,byte,int,byte*) = path_1o1;
+void (*fz_path_w4i1o4)(byte*,byte*,byte,int,byte*) = path_w4i1o4;
void (*fz_text_1c1)(byte*,int,byte*,int,int,int) = text_1c1;
void (*fz_text_1o1)(byte*,int,byte*,int,int,int) = text_1o1;