summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2010-06-15 23:24:56 +0200
committerRobin Watts <robin.watts@artifex.com>2010-06-15 23:24:56 +0200
commitcc098ffbfd88de6f186cdbb88242413eb17f5079 (patch)
treecb4cac5256a51cb69f02e44c6b0be691968ccd1c /fitz
parent0604c0103d3a1a5a75ab7bd3060ff34bd8973592 (diff)
downloadmupdf-cc098ffbfd88de6f186cdbb88242413eb17f5079.tar.xz
Remove all use of the fz_mul255 macro in the porterduff/imagedraw code in favour of doing blending using some macros.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/fitz_draw.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/fitz/fitz_draw.h b/fitz/fitz_draw.h
index 4ef84e1d..e622d81a 100644
--- a/fitz/fitz_draw.h
+++ b/fitz/fitz_draw.h
@@ -450,6 +450,21 @@ void fz_strokepath(fz_gel *gel, fz_path *path, fz_strokestate *stroke, fz_matrix
void fz_dashpath(fz_gel *gel, fz_path *path, fz_strokestate *stroke, fz_matrix ctm, float flatness, float linewidth);
/*
+ * Macros used to do blending
+ */
+
+/* Expand a value A from the 0...255 range to the 0..256 range */
+#define FZ_EXPAND(A) ((A)+((A)>>7))
+
+/* Combine values A (in any range) and B (in the 0..256 range),
+ * to give a single value in the same range as A was. */
+#define FZ_COMBINE(A,B) (((A)*(B))>>8)
+
+/* Blend SRC and DST (in the same range) together according to
+ * AMOUNT (in the 0...256 range). */
+#define FZ_BLEND(SRC, DST, AMOUNT) ((((SRC)-(DST))*(AMOUNT) + ((DST)<<8))>>8)
+
+/*
* Function pointers -- they can be replaced by cpu-optimized versions
*/
@@ -492,4 +507,3 @@ extern void (*fz_scol1)(unsigned char *src, unsigned char *dst, int w, int denom
extern void (*fz_scol2)(unsigned char *src, unsigned char *dst, int w, int denom);
extern void (*fz_scol4)(unsigned char *src, unsigned char *dst, int w, int denom);
extern void (*fz_scol5)(unsigned char *src, unsigned char *dst, int w, int denom);
-