diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-09-06 22:00:48 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-09-06 22:00:48 +0200 |
commit | 32ee8f594db8c6221db2c42949e0ee58cc47c176 (patch) | |
tree | 71cd3315cd82ecde3d9c6f3ba4f01bf7b82ee856 | |
parent | 0cdc74747cd941b5879a4d2de6c7a71a9b99a23b (diff) | |
download | mupdf-32ee8f594db8c6221db2c42949e0ee58cc47c176.tar.xz |
Don't invoke tiling device calls when there is only one tile to be drawn.
-rw-r--r-- | pdf/pdf_interpret.c | 12 | ||||
-rw-r--r-- | xps/xps_tile.c | 17 |
2 files changed, 16 insertions, 13 deletions
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index 1682f79a..b49d9c11 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -973,7 +973,10 @@ pdf_show_pattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what) oldtop = csi->gtop; #ifdef TILE - if ((x1 - x0) * (y1 - y0) > 0) + if ((x1 - x0) * (y1 - y0) > 1) +#else + if (0) +#endif { fz_begin_tile(csi->dev, area, pat->bbox, pat->xstep, pat->ystep, ptm); gstate->ctm = ptm; @@ -987,7 +990,7 @@ pdf_show_pattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what) pdf_grestore(csi); fz_end_tile(csi->dev); } -#else + else { int x, y; for (y = y0; y < y1; y++) @@ -996,7 +999,9 @@ pdf_show_pattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what) { gstate->ctm = fz_concat(fz_translate(x * pat->xstep, y * pat->ystep), ptm); csi->top_ctm = gstate->ctm; - error = pdf_run_csi_buffer(csi, pat->resources, pat->contents); + pdf_gsave(csi); + error = pdf_run_buffer(csi, pat->resources, pat->contents); + pdf_grestore(csi); while (oldtop < csi->gtop) pdf_grestore(csi); if (error) @@ -1008,7 +1013,6 @@ pdf_show_pattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what) } } cleanup: -#endif csi->top_ctm = oldtopctm; diff --git a/xps/xps_tile.c b/xps/xps_tile.c index 0ea271c8..d67a9b24 100644 --- a/xps/xps_tile.c +++ b/xps/xps_tile.c @@ -176,19 +176,19 @@ xps_parse_tiling_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, y1 = ceilf(area.y1 / ystep); #ifdef TILE + if ((x1 - x0) * (y1 - y0) > 1) +#else + if (0) +#endif { - int n = (x1 - x0) * (y1 - y0); fz_rect bigview = viewbox; bigview.x1 = bigview.x0 + xstep; bigview.y1 = bigview.y0 + ystep; - if (n > 1) - fz_begin_tile(ctx->dev, area, bigview, xstep, ystep, ctm); - if (n > 0) - xps_paint_tiling_brush(ctx, ctm, viewbox, tile_mode, &c); - if (n > 1) - fz_end_tile(ctx->dev); + fz_begin_tile(ctx->dev, area, bigview, xstep, ystep, ctm); + xps_paint_tiling_brush(ctx, ctm, viewbox, tile_mode, &c); + fz_end_tile(ctx->dev); } -#else + else { int x, y; for (y = y0; y < y1; y++) @@ -200,7 +200,6 @@ xps_parse_tiling_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, } } } -#endif } else { |