summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-01-07 16:48:39 +0100
committerTor Andersson <tor@ghostscript.com>2010-01-07 16:48:39 +0100
commitc9b33125b5093df3df622c26fbb20a6dd8656ad0 (patch)
tree4b7af31d46d9eea22c866f12fe1952d7e6c55a51
parentef8397646d49affa535a5436954beb723a87ce13 (diff)
downloadmupdf-c9b33125b5093df3df622c26fbb20a6dd8656ad0.tar.xz
Shadings with background fill.
-rw-r--r--fitz/dev_draw.c35
-rw-r--r--fitzdraw/meshdraw.c1
2 files changed, 30 insertions, 6 deletions
diff --git a/fitz/dev_draw.c b/fitz/dev_draw.c
index 7a602b0a..563289e7 100644
--- a/fitz/dev_draw.c
+++ b/fitz/dev_draw.c
@@ -350,7 +350,11 @@ void fz_drawdrawshade(void *user, fz_shade *shade, fz_matrix ctm)
fz_rect bounds;
fz_irect bbox;
fz_irect clip;
- fz_pixmap *tmp;
+ fz_pixmap *temp;
+ float rgb[3];
+ unsigned char argb[4];
+ unsigned char *s;
+ int n;
bounds = fz_transformaabb(fz_concat(shade->matrix, ctm), shade->bbox);
bbox = fz_roundrect(bounds);
@@ -361,10 +365,31 @@ void fz_drawdrawshade(void *user, fz_shade *shade, fz_matrix ctm)
clip.y1 = dev->dest->y + dev->dest->h;
clip = fz_intersectirects(clip, bbox);
- tmp = fz_newpixmapwithrect(clip, dev->model->n + 1);
- fz_rendershade(shade, ctm, dev->model, tmp);
- blendover(tmp, dev->dest);
- fz_freepixmap(tmp);
+ temp = fz_newpixmapwithrect(clip, dev->model->n + 1);
+
+ if (shade->usebackground)
+ {
+ fz_convertcolor(shade->cs, shade->background, dev->model, rgb);
+ argb[0] = 255;
+ argb[1] = rgb[0] * 255;
+ argb[2] = rgb[1] * 255;
+ argb[3] = rgb[2] * 255;
+ s = temp->samples;
+ n = temp->w * temp->h;
+ while (n--)
+ {
+ *s++ = argb[0];
+ *s++ = argb[1];
+ *s++ = argb[2];
+ *s++ = argb[3];
+ }
+ blendover(temp, dev->dest);
+ }
+
+ fz_rendershade(shade, ctm, dev->model, temp);
+ blendover(temp, dev->dest);
+
+ fz_freepixmap(temp);
}
static inline void
diff --git a/fitzdraw/meshdraw.c b/fitzdraw/meshdraw.c
index 9722e9ec..b770a1b4 100644
--- a/fitzdraw/meshdraw.c
+++ b/fitzdraw/meshdraw.c
@@ -315,7 +315,6 @@ fz_rendershade(fz_shade *shade, fz_matrix ctm, fz_colorspace *destcs, fz_pixmap
{
unsigned char clut[256][3];
unsigned char *s, *d;
- fz_error error;
fz_pixmap *temp;
float rgb[3];
float tri[3][MAXN];