diff options
Diffstat (limited to 'draw/draw_device.c')
-rw-r--r-- | draw/draw_device.c | 261 |
1 files changed, 144 insertions, 117 deletions
diff --git a/draw/draw_device.c b/draw/draw_device.c index 279ef64d..76f934bd 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -1,4 +1,4 @@ -#include "fitz.h" +#include "fitz-internal.h" #define QUANT(x,a) (((int)((x) * (a))) / (a)) #define HSUBPIX 5.0 @@ -121,9 +121,9 @@ fz_knockout_begin(fz_draw_device *dev) state = push_stack(dev); - bbox = fz_bound_pixmap(state->dest); + bbox = fz_pixmap_bbox(dev->ctx, state->dest); bbox = fz_intersect_bbox(bbox, state->scissor); - dest = fz_new_pixmap_with_rect(dev->ctx, state->dest->colorspace, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, state->dest->colorspace, bbox); if (isolated) { @@ -154,7 +154,7 @@ fz_knockout_begin(fz_draw_device *dev) } else { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } #ifdef DUMP_GROUP_BLENDS @@ -248,7 +248,7 @@ fz_draw_fill_path(fz_device *devp, fz_path *path, int even_odd, fz_matrix ctm, if (state->blendmode & FZ_BLEND_KNOCKOUT) state = fz_knockout_begin(dev); - fz_convert_color(dev->ctx, colorspace, color, model, colorfv); + fz_convert_color(dev->ctx, model, colorfv, colorspace, color); for (i = 0; i < model->n; i++) colorbv[i] = colorfv[i] * 255; colorbv[i] = alpha * 255; @@ -302,7 +302,7 @@ fz_draw_stroke_path(fz_device *devp, fz_path *path, fz_stroke_state *stroke, fz_ if (state->blendmode & FZ_BLEND_KNOCKOUT) state = fz_knockout_begin(dev); - fz_convert_color(dev->ctx, colorspace, color, model, colorfv); + fz_convert_color(dev->ctx, model, colorfv, colorspace, color); for (i = 0; i < model->n; i++) colorbv[i] = colorfv[i] * 255; colorbv[i] = alpha * 255; @@ -354,13 +354,13 @@ fz_draw_clip_path(fz_device *devp, fz_path *path, fz_rect *rect, int even_odd, f return; } - state[1].mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].mask); - state[1].dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + state[1].dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, state[1].dest); if (state[1].shape) { - state[1].shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].shape); } @@ -399,13 +399,13 @@ fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, fz_rect *rect, fz_strok if (rect) bbox = fz_intersect_bbox(bbox, fz_round_rect(*rect)); - state[1].mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].mask); - state[1].dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + state[1].dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, state[1].dest); if (state->shape) { - state[1].shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].shape); } @@ -427,7 +427,7 @@ draw_glyph(unsigned char *colorbv, fz_pixmap *dst, fz_pixmap *msk, fz_bbox bbox; int x, y, w, h; - bbox = fz_bound_pixmap(msk); + bbox = fz_pixmap_bbox_no_ctx(msk); bbox.x0 += xorig; bbox.y0 += yorig; bbox.x1 += xorig; @@ -472,7 +472,7 @@ fz_draw_fill_text(fz_device *devp, fz_text *text, fz_matrix ctm, if (state->blendmode & FZ_BLEND_KNOCKOUT) state = fz_knockout_begin(dev); - fz_convert_color(dev->ctx, colorspace, color, model, colorfv); + fz_convert_color(dev->ctx, model, colorfv, colorspace, color); for (i = 0; i < model->n; i++) colorbv[i] = colorfv[i] * 255; colorbv[i] = alpha * 255; @@ -532,7 +532,7 @@ fz_draw_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke, fz_ if (state->blendmode & FZ_BLEND_KNOCKOUT) state = fz_knockout_begin(dev); - fz_convert_color(dev->ctx, colorspace, color, model, colorfv); + fz_convert_color(dev->ctx, model, colorfv, colorspace, color); for (i = 0; i < model->n; i++) colorbv[i] = colorfv[i] * 255; colorbv[i] = alpha * 255; @@ -600,13 +600,13 @@ fz_draw_clip_text(fz_device *devp, fz_text *text, fz_matrix ctm, int accumulate) if (accumulate == 0 || accumulate == 1) { - mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, mask); - dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, dest); if (state->shape) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } else @@ -673,13 +673,13 @@ fz_draw_clip_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke bbox = fz_round_rect(fz_bound_text(dev->ctx, text, ctm)); bbox = fz_intersect_bbox(bbox, state->scissor); - mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, mask); - dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, dest); if (state->shape) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } else @@ -762,11 +762,11 @@ fz_draw_fill_shade(fz_device *devp, fz_shade *shade, fz_matrix ctm, float alpha) if (alpha < 1) { - dest = fz_new_pixmap_with_rect(dev->ctx, state->dest->colorspace, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, state->dest->colorspace, bbox); fz_clear_pixmap(dev->ctx, dest); if (shape) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } } @@ -775,7 +775,7 @@ fz_draw_fill_shade(fz_device *devp, fz_shade *shade, fz_matrix ctm, float alpha) { unsigned char *s; int x, y, n, i; - fz_convert_color(dev->ctx, shade->colorspace, shade->background, model, colorfv); + fz_convert_color(dev->ctx, model, colorfv, shade->colorspace, shade->background); for (i = 0; i < model->n; i++) colorbv[i] = colorfv[i] * 255; colorbv[i] = 255; @@ -878,17 +878,19 @@ fz_transform_pixmap(fz_context *ctx, fz_pixmap *image, fz_matrix *ctm, int x, in } static void -fz_draw_fill_image(fz_device *devp, fz_pixmap *image, fz_matrix ctm, float alpha) +fz_draw_fill_image(fz_device *devp, fz_image *image, fz_matrix ctm, float alpha) { fz_draw_device *dev = devp->user; fz_pixmap *converted = NULL; fz_pixmap *scaled = NULL; + fz_pixmap *pixmap; + fz_pixmap *orig_pixmap; int after; int dx, dy; fz_context *ctx = dev->ctx; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; - fz_bbox clip = fz_bound_pixmap(state->dest); + fz_bbox clip = fz_pixmap_bbox(ctx, state->dest); clip = fz_intersect_bbox(clip, state->scissor); @@ -903,133 +905,153 @@ fz_draw_fill_image(fz_device *devp, fz_pixmap *image, fz_matrix ctm, float alpha if (image->w == 0 || image->h == 0) return; + dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); + dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); + + pixmap = fz_image_to_pixmap(ctx, image, dx, dy); + orig_pixmap = pixmap; + /* convert images with more components (cmyk->rgb) before scaling */ /* convert images with fewer components (gray->rgb after scaling */ /* convert images with expensive colorspace transforms after scaling */ - if (state->blendmode & FZ_BLEND_KNOCKOUT) - state = fz_knockout_begin(dev); + fz_try(ctx) + { + if (state->blendmode & FZ_BLEND_KNOCKOUT) + state = fz_knockout_begin(dev); - after = 0; - if (image->colorspace == fz_device_gray) - after = 1; + after = 0; + if (pixmap->colorspace == fz_device_gray) + after = 1; - if (image->colorspace != model && !after) - { - converted = fz_new_pixmap_with_rect(ctx, model, fz_bound_pixmap(image)); - fz_convert_pixmap(ctx, image, converted); - image = converted; - } + if (pixmap->colorspace != model && !after) + { + converted = fz_new_pixmap_with_bbox(ctx, model, fz_pixmap_bbox(ctx, pixmap)); + fz_convert_pixmap(ctx, converted, pixmap); + pixmap = converted; + } - fz_try(ctx) - { - dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); - dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); - if (dx < image->w && dy < image->h) + if (dx < pixmap->w && dy < pixmap->h) { int gridfit = alpha == 1.0f && !(dev->flags & FZ_DRAWDEV_FLAGS_TYPE3); - scaled = fz_transform_pixmap(ctx, image, &ctm, state->dest->x, state->dest->y, dx, dy, gridfit, &clip); + scaled = fz_transform_pixmap(ctx, pixmap, &ctm, state->dest->x, state->dest->y, dx, dy, gridfit, &clip); if (!scaled) { if (dx < 1) dx = 1; if (dy < 1) dy = 1; - scaled = fz_scale_pixmap(ctx, image, image->x, image->y, dx, dy, NULL); + scaled = fz_scale_pixmap(ctx, pixmap, pixmap->x, pixmap->y, dx, dy, NULL); } if (scaled) - image = scaled; + pixmap = scaled; } - if (image->colorspace != model) + if (pixmap->colorspace != model) { - if ((image->colorspace == fz_device_gray && model == fz_device_rgb) || - (image->colorspace == fz_device_gray && model == fz_device_bgr)) + if ((pixmap->colorspace == fz_device_gray && model == fz_device_rgb) || + (pixmap->colorspace == fz_device_gray && model == fz_device_bgr)) { /* We have special case rendering code for gray -> rgb/bgr */ } else { - converted = fz_new_pixmap_with_rect(ctx, model, fz_bound_pixmap(image)); - fz_convert_pixmap(ctx, image, converted); - image = converted; + converted = fz_new_pixmap_with_bbox(ctx, model, fz_pixmap_bbox(ctx, pixmap)); + fz_convert_pixmap(ctx, converted, pixmap); + pixmap = converted; } } - fz_paint_image(state->dest, state->scissor, state->shape, image, ctm, alpha * 255); + fz_paint_image(state->dest, state->scissor, state->shape, pixmap, ctm, alpha * 255); + + if (state->blendmode & FZ_BLEND_KNOCKOUT) + fz_knockout_end(dev); } - fz_catch(ctx) + fz_always(ctx) { fz_drop_pixmap(ctx, scaled); fz_drop_pixmap(ctx, converted); + fz_drop_pixmap(ctx, orig_pixmap); + } + fz_catch(ctx) + { fz_rethrow(ctx); } - - if (scaled) - fz_drop_pixmap(ctx, scaled); - if (converted) - fz_drop_pixmap(ctx, converted); - - if (state->blendmode & FZ_BLEND_KNOCKOUT) - fz_knockout_end(dev); } static void -fz_draw_fill_image_mask(fz_device *devp, fz_pixmap *image, fz_matrix ctm, +fz_draw_fill_image_mask(fz_device *devp, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) { fz_draw_device *dev = devp->user; unsigned char colorbv[FZ_MAX_COLORS + 1]; float colorfv[FZ_MAX_COLORS]; fz_pixmap *scaled = NULL; + fz_pixmap *pixmap; + fz_pixmap *orig_pixmap; int dx, dy; int i; + fz_context *ctx = dev->ctx; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; - fz_bbox clip = fz_bound_pixmap(state->dest); + fz_bbox clip = fz_pixmap_bbox(ctx, state->dest); clip = fz_intersect_bbox(clip, state->scissor); if (image->w == 0 || image->h == 0) return; - if (state->blendmode & FZ_BLEND_KNOCKOUT) - state = fz_knockout_begin(dev); - dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); - if (dx < image->w && dy < image->h) + pixmap = fz_image_to_pixmap(ctx, image, dx, dy); + orig_pixmap = pixmap; + + fz_try(ctx) { - int gridfit = alpha == 1.0f && !(dev->flags & FZ_DRAWDEV_FLAGS_TYPE3); - scaled = fz_transform_pixmap(dev->ctx, image, &ctm, state->dest->x, state->dest->y, dx, dy, gridfit, &clip); - if (!scaled) + if (state->blendmode & FZ_BLEND_KNOCKOUT) + state = fz_knockout_begin(dev); + + if (dx < pixmap->w && dy < pixmap->h) { - if (dx < 1) - dx = 1; - if (dy < 1) - dy = 1; - scaled = fz_scale_pixmap(dev->ctx, image, image->x, image->y, dx, dy, NULL); + int gridfit = alpha == 1.0f && !(dev->flags & FZ_DRAWDEV_FLAGS_TYPE3); + scaled = fz_transform_pixmap(dev->ctx, pixmap, &ctm, state->dest->x, state->dest->y, dx, dy, gridfit, &clip); + if (!scaled) + { + if (dx < 1) + dx = 1; + if (dy < 1) + dy = 1; + scaled = fz_scale_pixmap(dev->ctx, pixmap, pixmap->x, pixmap->y, dx, dy, NULL); + } + if (scaled) + pixmap = scaled; } - if (scaled) - image = scaled; - } - fz_convert_color(dev->ctx, colorspace, color, model, colorfv); - for (i = 0; i < model->n; i++) - colorbv[i] = colorfv[i] * 255; - colorbv[i] = alpha * 255; + fz_convert_color(dev->ctx, model, colorfv, colorspace, color); + for (i = 0; i < model->n; i++) + colorbv[i] = colorfv[i] * 255; + colorbv[i] = alpha * 255; - fz_paint_image_with_color(state->dest, state->scissor, state->shape, image, ctm, colorbv); + fz_paint_image_with_color(state->dest, state->scissor, state->shape, pixmap, ctm, colorbv); - if (scaled) - fz_drop_pixmap(dev->ctx, scaled); + if (scaled) + fz_drop_pixmap(dev->ctx, scaled); - if (state->blendmode & FZ_BLEND_KNOCKOUT) - fz_knockout_end(dev); + if (state->blendmode & FZ_BLEND_KNOCKOUT) + fz_knockout_end(dev); + } + fz_always(ctx) + { + fz_drop_pixmap(dev->ctx, orig_pixmap); + } + fz_catch(ctx) + { + fz_rethrow(ctx); + } } static void -fz_draw_clip_image_mask(fz_device *devp, fz_pixmap *image, fz_rect *rect, fz_matrix ctm) +fz_draw_clip_image_mask(fz_device *devp, fz_image *image, fz_rect *rect, fz_matrix ctm) { fz_draw_device *dev = devp->user; fz_context *ctx = dev->ctx; @@ -1038,10 +1060,12 @@ fz_draw_clip_image_mask(fz_device *devp, fz_pixmap *image, fz_rect *rect, fz_mat fz_pixmap *dest = NULL; fz_pixmap *shape = NULL; fz_pixmap *scaled = NULL; + fz_pixmap *pixmap; + fz_pixmap *orig_pixmap; int dx, dy; fz_draw_state *state = push_stack(dev); fz_colorspace *model = state->dest->colorspace; - fz_bbox clip = fz_bound_pixmap(state->dest); + fz_bbox clip = fz_pixmap_bbox(ctx, state->dest); clip = fz_intersect_bbox(clip, state->scissor); @@ -1068,35 +1092,46 @@ fz_draw_clip_image_mask(fz_device *devp, fz_pixmap *image, fz_rect *rect, fz_mat if (rect) bbox = fz_intersect_bbox(bbox, fz_round_rect(*rect)); - mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); - fz_clear_pixmap(dev->ctx, mask); + dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); + dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); + pixmap = fz_image_to_pixmap(ctx, image, dx, dy); + orig_pixmap = pixmap; + fz_try(ctx) { - dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); + fz_clear_pixmap(dev->ctx, mask); + + dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, dest); if (state->shape) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } - dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); - dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); - if (dx < image->w && dy < image->h) + if (dx < pixmap->w && dy < pixmap->h) { int gridfit = !(dev->flags & FZ_DRAWDEV_FLAGS_TYPE3); - scaled = fz_transform_pixmap(dev->ctx, image, &ctm, state->dest->x, state->dest->y, dx, dy, gridfit, &clip); + scaled = fz_transform_pixmap(dev->ctx, pixmap, &ctm, state->dest->x, state->dest->y, dx, dy, gridfit, &clip); if (!scaled) { if (dx < 1) dx = 1; if (dy < 1) dy = 1; - scaled = fz_scale_pixmap(dev->ctx, image, image->x, image->y, dx, dy, NULL); + scaled = fz_scale_pixmap(dev->ctx, pixmap, pixmap->x, pixmap->y, dx, dy, NULL); } if (scaled) - image = scaled; + pixmap = scaled; } + fz_paint_image(mask, bbox, state->shape, pixmap, ctm, 255); + + } + fz_always(ctx) + { + fz_drop_pixmap(ctx, scaled); + fz_drop_pixmap(ctx, orig_pixmap); } fz_catch(ctx) { @@ -1106,11 +1141,6 @@ fz_draw_clip_image_mask(fz_device *devp, fz_pixmap *image, fz_rect *rect, fz_mat fz_rethrow(ctx); } - fz_paint_image(mask, bbox, state->shape, image, ctm, 255); - - if (scaled) - fz_drop_pixmap(dev->ctx, scaled); - state[1].blendmode |= FZ_BLEND_ISOLATED; state[1].scissor = bbox; state[1].dest = dest; @@ -1181,12 +1211,12 @@ fz_draw_begin_mask(fz_device *devp, fz_rect rect, int luminosity, fz_colorspace bbox = fz_round_rect(rect); bbox = fz_intersect_bbox(bbox, state->scissor); - dest = fz_new_pixmap_with_rect(dev->ctx, fz_device_gray, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, fz_device_gray, bbox); if (state->shape) { /* FIXME: If we ever want to support AIS true, then we * probably want to create a shape pixmap here, using: - * shape = fz_new_pixmap_with_rect(NULL, bbox); + * shape = fz_new_pixmap_with_bbox(NULL, bbox); * then, in the end_mask code, we create the mask from this * rather than dest. */ @@ -1198,7 +1228,7 @@ fz_draw_begin_mask(fz_device *devp, fz_rect rect, int luminosity, fz_colorspace float bc; if (!colorspace) colorspace = fz_device_gray; - fz_convert_color(dev->ctx, colorspace, colorfv, fz_device_gray, &bc); + fz_convert_color(dev->ctx, fz_device_gray, &bc, colorspace, colorfv); fz_clear_pixmap_with_value(dev->ctx, dest, bc * 255); if (shape) fz_clear_pixmap_with_value(dev->ctx, shape, 255); @@ -1254,8 +1284,8 @@ fz_draw_end_mask(fz_device *devp) state[1].mask = NULL; /* create new dest scratch buffer */ - bbox = fz_bound_pixmap(temp); - dest = fz_new_pixmap_with_rect(dev->ctx, state->dest->colorspace, bbox); + bbox = fz_pixmap_bbox(ctx, temp); + dest = fz_new_pixmap_with_bbox(dev->ctx, state->dest->colorspace, bbox); fz_clear_pixmap(dev->ctx, dest); /* push soft mask as clip mask */ @@ -1266,7 +1296,7 @@ fz_draw_end_mask(fz_device *devp) * clip mask when we pop. So create a new shape now. */ if (state[0].shape) { - state[1].shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].shape); } state[1].scissor = bbox; @@ -1288,7 +1318,7 @@ fz_draw_begin_group(fz_device *devp, fz_rect rect, int isolated, int knockout, i state = push_stack(dev); bbox = fz_round_rect(rect); bbox = fz_intersect_bbox(bbox, state->scissor); - dest = fz_new_pixmap_with_rect(ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(ctx, model, bbox); #ifndef ATTEMPT_KNOCKOUT_AND_ISOLATED knockout = 0; @@ -1314,7 +1344,7 @@ fz_draw_begin_group(fz_device *devp, fz_rect rect, int isolated, int knockout, i { fz_try(ctx) { - shape = fz_new_pixmap_with_rect(ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } fz_catch(ctx) @@ -1421,7 +1451,7 @@ fz_draw_begin_tile(fz_device *devp, fz_rect area, fz_rect view, float xstep, flo * assert(bbox.x0 > state->dest->x || bbox.x1 < state->dest->x + state->dest->w || * bbox.y0 > state->dest->y || bbox.y1 < state->dest->y + state->dest->h); */ - dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(ctx, dest); shape = state[0].shape; if (shape) @@ -1429,7 +1459,7 @@ fz_draw_begin_tile(fz_device *devp, fz_rect area, fz_rect view, float xstep, flo fz_var(shape); fz_try(ctx) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(ctx, shape); } fz_catch(ctx) @@ -1552,9 +1582,6 @@ fz_draw_free_user(fz_device *devp) state--; } while(--dev->top > 0); - fz_drop_pixmap(ctx, dev->stack[0].mask); - fz_drop_pixmap(ctx, dev->stack[0].dest); - fz_drop_pixmap(ctx, dev->stack[0].shape); } if (dev->stack != &dev->init_stack[0]) fz_free(ctx, dev->stack); |