diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-04-01 15:29:02 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-04-01 15:29:02 +0200 |
commit | 6192f4c4fdec838fd5ef86a17517d615d7ff16ca (patch) | |
tree | a93ddfaa7d83ae284bd7123c0db010fb734e2994 | |
parent | ed88bc126023a80536ba437a75b250ba1a95eafb (diff) | |
download | mupdf-6192f4c4fdec838fd5ef86a17517d615d7ff16ca.tar.xz |
xps: Pass bounding box to opacity mask brush.
-rw-r--r-- | xps/muxps.h | 6 | ||||
-rw-r--r-- | xps/xpscommon.c | 4 | ||||
-rw-r--r-- | xps/xpsglyphs.c | 2 | ||||
-rw-r--r-- | xps/xpsgradient.c | 14 | ||||
-rw-r--r-- | xps/xpsopacity.c | 10 | ||||
-rw-r--r-- | xps/xpspage.c | 2 | ||||
-rw-r--r-- | xps/xpspath.c | 2 | ||||
-rw-r--r-- | xps/xpstile.c | 4 |
8 files changed, 21 insertions, 23 deletions
diff --git a/xps/muxps.h b/xps/muxps.h index 0bb03584..51c0323e 100644 --- a/xps/muxps.h +++ b/xps/muxps.h @@ -191,8 +191,8 @@ void xps_parse_glyphs(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resou void xps_parse_solid_color_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); void xps_parse_image_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *node); void xps_parse_visual_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *node); -void xps_parse_linear_gradient_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); -void xps_parse_radial_gradient_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_linear_gradient_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_radial_gradient_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *node); void xps_parse_tiling_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *root, void(*func)(xps_context*, fz_matrix, char*, xps_resource*, xps_item*, void*), void *user); @@ -202,7 +202,7 @@ void xps_parse_rectangle(xps_context *ctx, char *text, fz_rect *rect); fz_path *xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule); fz_path *xps_parse_path_geometry(xps_context *ctx, xps_resource *dict, xps_item *root, int stroking, int *fill_rule); -void xps_begin_opacity(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, char *opacity_att, xps_item *opacity_mask_tag); +void xps_begin_opacity(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, char *opacity_att, xps_item *opacity_mask_tag); void xps_end_opacity(xps_context *ctx, char *base_uri, xps_resource *dict, char *opacity_att, xps_item *opacity_mask_tag); void xps_parse_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *node); diff --git a/xps/xpscommon.c b/xps/xpscommon.c index 3213f3e9..063435c5 100644 --- a/xps/xpscommon.c +++ b/xps/xpscommon.c @@ -10,9 +10,9 @@ xps_parse_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, x else if (!strcmp(xps_tag(node), "VisualBrush")) xps_parse_visual_brush(ctx, ctm, area, base_uri, dict, node); else if (!strcmp(xps_tag(node), "LinearGradientBrush")) - xps_parse_linear_gradient_brush(ctx, ctm, base_uri, dict, node); + xps_parse_linear_gradient_brush(ctx, ctm, area, base_uri, dict, node); else if (!strcmp(xps_tag(node), "RadialGradientBrush")) - xps_parse_radial_gradient_brush(ctx, ctm, base_uri, dict, node); + xps_parse_radial_gradient_brush(ctx, ctm, area, base_uri, dict, node); else fz_warn("unknown brush tag: %s", xps_tag(node)); } diff --git a/xps/xpsglyphs.c b/xps/xpsglyphs.c index f857542c..f62cc928 100644 --- a/xps/xpsglyphs.c +++ b/xps/xpsglyphs.c @@ -456,7 +456,7 @@ xps_parse_glyphs(xps_context *ctx, fz_matrix ctm, area = fz_boundtext(text, ctm); - xps_begin_opacity(ctx, ctm, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); + xps_begin_opacity(ctx, ctm, area, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); /* * If it's a solid color brush fill/stroke do a simple fill diff --git a/xps/xpsgradient.c b/xps/xpsgradient.c index 340528bb..180224f8 100644 --- a/xps/xpsgradient.c +++ b/xps/xpsgradient.c @@ -366,7 +366,7 @@ xps_draw_linear_gradient(xps_context *ctx, fz_matrix ctm, */ static void -xps_parse_gradient_brush(xps_context *ctx, fz_matrix ctm, +xps_parse_gradient_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *root, void (*draw)(xps_context *, fz_matrix, struct stop *, int, xps_item *, int)) { @@ -436,7 +436,9 @@ xps_parse_gradient_brush(xps_context *ctx, fz_matrix ctm, return; } - xps_begin_opacity(ctx, ctm, base_uri, dict, opacity_att, NULL); + area = fz_transformrect(ctm, area); + + xps_begin_opacity(ctx, ctm, area, base_uri, dict, opacity_att, NULL); draw(ctx, ctm, stop_list, stop_count, root, spread_method); @@ -444,15 +446,15 @@ xps_parse_gradient_brush(xps_context *ctx, fz_matrix ctm, } void -xps_parse_linear_gradient_brush(xps_context *ctx, fz_matrix ctm, +xps_parse_linear_gradient_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *root) { - xps_parse_gradient_brush(ctx, ctm, base_uri, dict, root, xps_draw_linear_gradient); + xps_parse_gradient_brush(ctx, ctm, area, base_uri, dict, root, xps_draw_linear_gradient); } void -xps_parse_radial_gradient_brush(xps_context *ctx, fz_matrix ctm, +xps_parse_radial_gradient_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_uri, xps_resource *dict, xps_item *root) { - xps_parse_gradient_brush(ctx, ctm, base_uri, dict, root, xps_draw_radial_gradient); + xps_parse_gradient_brush(ctx, ctm, area, base_uri, dict, root, xps_draw_radial_gradient); } diff --git a/xps/xpsopacity.c b/xps/xpsopacity.c index db7bc400..e5b0f787 100644 --- a/xps/xpsopacity.c +++ b/xps/xpsopacity.c @@ -2,10 +2,10 @@ #include "muxps.h" void -xps_begin_opacity(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, - char *opacity_att, xps_item *opacity_mask_tag) +xps_begin_opacity(xps_context *ctx, fz_matrix ctm, fz_rect area, + char *base_uri, xps_resource *dict, + char *opacity_att, xps_item *opacity_mask_tag) { - fz_rect area; float opacity; if (!opacity_att && !opacity_mask_tag) @@ -31,8 +31,6 @@ xps_begin_opacity(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource opacity_mask_tag = NULL; } - area = fz_infiniterect; /* FIXME */ - if (ctx->opacity_top + 1 < nelem(ctx->opacity)) { ctx->opacity[ctx->opacity_top + 1] = ctx->opacity[ctx->opacity_top] * opacity; @@ -49,7 +47,7 @@ xps_begin_opacity(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource void xps_end_opacity(xps_context *ctx, char *base_uri, xps_resource *dict, - char *opacity_att, xps_item *opacity_mask_tag) + char *opacity_att, xps_item *opacity_mask_tag) { if (!opacity_att && !opacity_mask_tag) return; diff --git a/xps/xpspage.c b/xps/xpspage.c index 0188eb62..1854b1fc 100644 --- a/xps/xpspage.c +++ b/xps/xpspage.c @@ -62,7 +62,7 @@ xps_parse_canvas(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource * if (clip_att || clip_tag) xps_clip(ctx, ctm, dict, clip_att, clip_tag); - xps_begin_opacity(ctx, ctm, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); + xps_begin_opacity(ctx, ctm, fz_infiniterect, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); for (node = xps_down(root); node; node = xps_next(node)) { diff --git a/xps/xpspath.c b/xps/xpspath.c index d5063a87..250ab022 100644 --- a/xps/xpspath.c +++ b/xps/xpspath.c @@ -940,7 +940,7 @@ xps_parse_path(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *di else area = fz_boundpath(path, NULL, ctm); - xps_begin_opacity(ctx, ctm, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); + xps_begin_opacity(ctx, ctm, area, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); if (fill_att) { diff --git a/xps/xpstile.c b/xps/xpstile.c index dedb0a3d..1b96a7d3 100644 --- a/xps/xpstile.c +++ b/xps/xpstile.c @@ -158,7 +158,7 @@ xps_parse_tiling_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, if (tile_mode == TILE_FLIP_Y || tile_mode == TILE_FLIP_X_Y) ystep *= 2; - xps_begin_opacity(ctx, ctm, base_uri, dict, opacity_att, NULL); + xps_begin_opacity(ctx, ctm, area, base_uri, dict, opacity_att, NULL); ctm = fz_concat(transform, ctm); ctm = fz_concat(fz_translate(viewport.x0, viewport.y0), ctm); @@ -175,8 +175,6 @@ xps_parse_tiling_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, int y1 = ceilf(bbox.y1 / ystep); int x, y; - printf("repeating tile %d x %d times\n", x1-x0, y1-y0); - for (y = y0; y < y1; y++) { for (x = x0; x < x1; x++) |