diff options
Diffstat (limited to 'draw/draw_simple_scale.c')
-rw-r--r-- | draw/draw_simple_scale.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/draw/draw_simple_scale.c b/draw/draw_simple_scale.c index c2d429b1..dcd5cd68 100644 --- a/draw/draw_simple_scale.c +++ b/draw/draw_simple_scale.c @@ -227,7 +227,7 @@ struct fz_weights_s }; static fz_weights * -new_weights(fz_scale_filter *filter, int src_w, float dst_w, int dst_w_i, int n, int flip) +new_weights(fz_context *ctx, fz_scale_filter *filter, int src_w, float dst_w, int dst_w_i, int n, int flip) { int max_len; fz_weights *weights; @@ -253,7 +253,7 @@ new_weights(fz_scale_filter *filter, int src_w, float dst_w, int dst_w_i, int n, * plus (2+max_len)*sizeof(int) for the weights * plus room for an extra set of weights for reordering. */ - weights = fz_malloc(sizeof(*weights)+(max_len+3)*(dst_w_i+1)*sizeof(int)); + weights = fz_malloc(ctx, sizeof(*weights)+(max_len+3)*(dst_w_i+1)*sizeof(int)); if (weights == NULL) return NULL; weights->count = -1; @@ -443,7 +443,7 @@ check_weights(fz_weights *weights, int j, int w, float x, float wf) } static fz_weights * -make_weights(int src_w, float x, float dst_w, fz_scale_filter *filter, int vertical, int dst_w_int, int n, int flip) +make_weights(fz_context *ctx, int src_w, float x, float dst_w, fz_scale_filter *filter, int vertical, int dst_w_int, int n, int flip) { fz_weights *weights; float F, G; @@ -464,7 +464,7 @@ make_weights(int src_w, float x, float dst_w, fz_scale_filter *filter, int verti } window = filter->width / F; DBUG(("make_weights src_w=%d x=%g dst_w=%g dst_w_int=%d F=%g window=%g\n", src_w, x, dst_w, dst_w_int, F, window)); - weights = new_weights(filter, src_w, dst_w, dst_w_int, n, flip); + weights = new_weights(ctx, filter, src_w, dst_w, dst_w_int, n, flip); if (weights == NULL) return NULL; for (j = 0; j < dst_w_int; j++) @@ -1167,7 +1167,7 @@ scale_single_col(unsigned char *dst, unsigned char *src, fz_weights *weights, in #endif /* SINGLE_PIXEL_SPECIALS */ fz_pixmap * -fz_scale_pixmap(fz_pixmap *src, float x, float y, float w, float h) +fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h) { fz_scale_filter *filter = &fz_scale_filter_simple; fz_weights *contrib_rows = NULL; @@ -1249,7 +1249,7 @@ fz_scale_pixmap(fz_pixmap *src, float x, float y, float w, float h) else #endif /* SINGLE_PIXEL_SPECIALS */ { - contrib_cols = make_weights(src->w, x, w, filter, 0, dst_w_int, src->n, flip_x); + contrib_cols = make_weights(ctx, src->w, x, w, filter, 0, dst_w_int, src->n, flip_x); if (contrib_cols == NULL) goto cleanup; } @@ -1261,14 +1261,14 @@ fz_scale_pixmap(fz_pixmap *src, float x, float y, float w, float h) else #endif /* SINGLE_PIXEL_SPECIALS */ { - contrib_rows = make_weights(src->h, y, h, filter, 1, dst_h_int, src->n, flip_y); + contrib_rows = make_weights(ctx, src->h, y, h, filter, 1, dst_h_int, src->n, flip_y); if (contrib_rows == NULL) goto cleanup; } assert(contrib_cols == NULL || contrib_cols->count == dst_w_int); assert(contrib_rows == NULL || contrib_rows->count == dst_h_int); - output = fz_new_pixmap(src->colorspace, dst_w_int, dst_h_int); + output = fz_new_pixmap(ctx, src->colorspace, dst_w_int, dst_h_int); output->x = dst_x_int; output->y = dst_y_int; @@ -1302,7 +1302,7 @@ fz_scale_pixmap(fz_pixmap *src, float x, float y, float w, float h) temp_rows = contrib_rows->max_len; if (temp_span <= 0 || temp_rows > INT_MAX / temp_span) goto cleanup; - temp = fz_calloc(temp_span*temp_rows, sizeof(unsigned char)); + temp = fz_calloc(ctx, temp_span*temp_rows, sizeof(unsigned char)); if (temp == NULL) goto cleanup; switch (src->n) @@ -1343,11 +1343,11 @@ fz_scale_pixmap(fz_pixmap *src, float x, float y, float w, float h) DBUG(("scaling row %d from temp\n", row)); scale_row_from_temp(&output->samples[row*output->w*output->n], temp, contrib_rows, temp_span, row); } - fz_free(temp); + fz_free(ctx, temp); } cleanup: - fz_free(contrib_rows); - fz_free(contrib_cols); + fz_free(ctx, contrib_rows); + fz_free(ctx, contrib_cols); return output; } |