diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-12-29 01:52:21 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-12-29 01:52:21 +0000 |
commit | dac0181028f2e02f44dd258e91d2df66975c3b89 (patch) | |
tree | 7a073e2b28acfe3b1e43afa8bf7987bbf3cca797 /fitz | |
parent | 6b935a6c9c2a2fa7a0fd4fdd6919ea7965fa4942 (diff) | |
download | mupdf-dac0181028f2e02f44dd258e91d2df66975c3b89.tar.xz |
Support linear shadings as a special case in the fitz shading struct and renderer.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/fitz.h | 10 | ||||
-rw-r--r-- | fitz/res_shade.c | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h index 99751b3e..3275dc4e 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -795,6 +795,13 @@ fz_text *fz_clonetext(fz_text *old); * The shading code uses gouraud shaded triangle meshes. */ +enum +{ + FZ_LINEAR, + FZ_RADIAL, + FZ_MESH, +}; + typedef struct fz_shade_s fz_shade; struct fz_shade_s @@ -811,6 +818,9 @@ struct fz_shade_s int usefunction; float function[256][FZ_MAXCOLORS]; + int type; /* linear, radial, mesh */ + int extend[2]; + int meshlen; int meshcap; float *mesh; /* [x y t] or [x y c1 ... cn] */ diff --git a/fitz/res_shade.c b/fitz/res_shade.c index 30d2bd16..d6108236 100644 --- a/fitz/res_shade.c +++ b/fitz/res_shade.c @@ -32,6 +32,11 @@ fz_boundshade(fz_shade *shade, fz_matrix ctm) nvert = shade->meshlen / ncomp; v = shade->mesh; + if (shade->type == FZ_LINEAR) + return fz_infiniterect; + if (shade->type == FZ_RADIAL) + return fz_infiniterect; + if (nvert == 0) return fz_emptyrect; @@ -66,6 +71,13 @@ fz_debugshade(fz_shade *shade) printf("shading {\n"); + switch (shade->type) + { + case FZ_LINEAR: printf("\ttype linear\n"); break; + case FZ_RADIAL: printf("\ttype radial\n"); break; + case FZ_MESH: printf("\ttype mesh\n"); break; + } + printf("\tbbox [%g %g %g %g]\n", shade->bbox.x0, shade->bbox.y0, shade->bbox.x1, shade->bbox.y1); |