summaryrefslogtreecommitdiff
path: root/fitz/dev_draw.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-07-01 17:19:36 +0200
committerTor Andersson <tor@ghostscript.com>2010-07-01 17:19:36 +0200
commit43db0e886a753b6f11785b29e2e74a718216ff43 (patch)
tree8f30df199d03ec7d57fe2a83088237a9ade2d988 /fitz/dev_draw.c
parent45698f39beedeeaff4a35b84d3fdc1f9c5259b5b (diff)
downloadmupdf-43db0e886a753b6f11785b29e2e74a718216ff43.tar.xz
Compute shading bounding box using the triangle mesh.
Diffstat (limited to 'fitz/dev_draw.c')
-rw-r--r--fitz/dev_draw.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/fitz/dev_draw.c b/fitz/dev_draw.c
index 6050c09f..0906985f 100644
--- a/fitz/dev_draw.c
+++ b/fitz/dev_draw.c
@@ -452,12 +452,16 @@ fz_drawfillshade(void *user, fz_shade *shade, fz_matrix ctm)
fz_bbox bbox;
float colorfv[FZ_MAXCOLORS];
unsigned char colorbv[FZ_MAXCOLORS + 1];
- unsigned char *s;
- int x, y;
- bounds = fz_transformrect(fz_concat(shade->matrix, ctm), shade->bbox);
- bbox = fz_roundrect(bounds);
- bbox = fz_intersectbbox(bbox, dev->scissor);
+ bounds = fz_boundshade(shade, ctm);
+ bbox = fz_intersectbbox(fz_roundrect(bounds), dev->scissor);
+
+ // TODO: proper clip by shade->bbox
+ if (!fz_isemptyrect(shade->bbox))
+ {
+// bounds = fz_transformrect(fz_concat(shade->matrix, ctm), shade->bbox);
+// bbox = fz_intersectbbox(fz_roundrect(bounds), bbox);
+ }
if (fz_isemptyrect(bbox))
return;
@@ -470,19 +474,21 @@ fz_drawfillshade(void *user, fz_shade *shade, fz_matrix ctm)
if (shade->usebackground)
{
- /* FIXME: Could use optimisation */
- int i, n = dev->model->n + 1;
-
+ unsigned char *s;
+ int x, y, n, i;
+printf("usebackground!\n");
fz_convertcolor(shade->cs, shade->background, dev->model, colorfv);
- colorbv[0] = 255;
- for (i = 1; i < n; i++)
- colorbv[n-i] = colorfv[i-1] * 255;
+ for (i = 0; i < dev->model->n; i++)
+ colorbv[i] = colorfv[i] * 255;
+ colorbv[i] = 255;
+
+ n = dest->n;
for (y = bbox.y0; y < bbox.y1; y++)
{
s = dest->samples + ((bbox.x0 - dest->x) + (y - dest->y) * dest->w) * dest->n;
for (x = bbox.x0; x < bbox.x1; x++)
{
- for (i = n; i > 0; i--)
+ for (i = 0; i < n; i++)
*s++ = colorbv[i];
}
}