diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-03-13 13:36:39 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-03-13 14:03:09 +0100 |
commit | 7eca6b0d05443e85ecd7bb107dccf410696364aa (patch) | |
tree | e4f5c9a362e7a4c7b51b2d07087f422043de9f2f /fitz | |
parent | 48652e529ed1c0ae23cfd45f14d9655ad2849c89 (diff) | |
download | mupdf-7eca6b0d05443e85ecd7bb107dccf410696364aa.tar.xz |
Add ctx argument and rename fz_bound_pixmap to fz_pixmap_bbox.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/fitz-internal.h | 2 | ||||
-rw-r--r-- | fitz/fitz.h | 6 | ||||
-rw-r--r-- | fitz/image_save.c | 2 | ||||
-rw-r--r-- | fitz/res_colorspace.c | 2 | ||||
-rw-r--r-- | fitz/res_pixmap.c | 21 |
5 files changed, 23 insertions, 10 deletions
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h index 6d4b292b..2e9508a6 100644 --- a/fitz/fitz-internal.h +++ b/fitz/fitz-internal.h @@ -632,6 +632,8 @@ unsigned int fz_pixmap_size(fz_context *ctx, fz_pixmap *pix); fz_pixmap *fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, fz_bbox *clip); +fz_bbox fz_pixmap_bbox_no_ctx(fz_pixmap *src); + struct fz_image_s { fz_storable storable; diff --git a/fitz/fitz.h b/fitz/fitz.h index 33379df7..964bd7f7 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -1084,7 +1084,7 @@ typedef struct fz_colorspace_s fz_colorspace; fz_find_device_colorspace: Find a standard colorspace based upon it's name. */ -fz_colorspace *fz_find_device_colorspace(char *name); +fz_colorspace *fz_find_device_colorspace(fz_context *ctx, char *name); /* fz_device_gray: Abstract colorspace representing device specific @@ -1119,11 +1119,11 @@ extern fz_colorspace *fz_device_cmyk; typedef struct fz_pixmap_s fz_pixmap; /* - fz_bound_pixmap: Return a bounding box for a pixmap. + fz_pixmap_bbox: Return a bounding box for a pixmap. Returns an exact bounding box for the supplied pixmap. */ -fz_bbox fz_bound_pixmap(fz_pixmap *pix); +fz_bbox fz_pixmap_bbox(fz_context *ctx, fz_pixmap *pix); /* fz_pixmap_width: Return the width of the pixmap in pixels. diff --git a/fitz/image_save.c b/fitz/image_save.c index 614d18ce..95be1cd3 100644 --- a/fitz/image_save.c +++ b/fitz/image_save.c @@ -10,7 +10,7 @@ void fz_write_pixmap(fz_context *ctx, fz_pixmap *img, char *file, int rgb) if (rgb && img->colorspace && img->colorspace != fz_device_rgb) { - converted = fz_new_pixmap_with_bbox(ctx, fz_device_rgb, fz_bound_pixmap(img)); + converted = fz_new_pixmap_with_bbox(ctx, fz_device_rgb, fz_pixmap_bbox(ctx, img)); fz_convert_pixmap(ctx, converted, img); img = converted; } diff --git a/fitz/res_colorspace.c b/fitz/res_colorspace.c index 03d5967b..587db381 100644 --- a/fitz/res_colorspace.c +++ b/fitz/res_colorspace.c @@ -164,7 +164,7 @@ fz_colorspace *fz_device_bgr = &k_device_bgr; fz_colorspace *fz_device_cmyk = &k_device_cmyk; fz_colorspace * -fz_find_device_colorspace(char *name) +fz_find_device_colorspace(fz_context *ctx, char *name) { if (!strcmp(name, "DeviceGray")) return fz_device_gray; diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c index 11875ad1..a160b6ca 100644 --- a/fitz/res_pixmap.c +++ b/fitz/res_pixmap.c @@ -100,7 +100,18 @@ fz_new_pixmap_with_bbox_and_data(fz_context *ctx, fz_colorspace *colorspace, fz_ } fz_bbox -fz_bound_pixmap(fz_pixmap *pix) +fz_pixmap_bbox(fz_context *ctx, fz_pixmap *pix) +{ + fz_bbox bbox; + bbox.x0 = pix->x; + bbox.y0 = pix->y; + bbox.x1 = pix->x + pix->w; + bbox.y1 = pix->y + pix->h; + return bbox; +} + +fz_bbox +fz_pixmap_bbox_no_ctx(fz_pixmap *pix) { fz_bbox bbox; bbox.x0 = pix->x; @@ -156,8 +167,8 @@ fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, fz_bbox r) unsigned char *destp; int y, w, destspan, srcspan; - r = fz_intersect_bbox(r, fz_bound_pixmap(dest)); - r = fz_intersect_bbox(r, fz_bound_pixmap(src)); + r = fz_intersect_bbox(r, fz_pixmap_bbox(ctx, dest)); + r = fz_intersect_bbox(r, fz_pixmap_bbox(ctx, src)); w = r.x1 - r.x0; y = r.y1 - r.y0; if (w <= 0 || y <= 0) @@ -183,7 +194,7 @@ fz_clear_pixmap_rect_with_value(fz_context *ctx, fz_pixmap *dest, int value, fz_ unsigned char *destp; int x, y, w, k, destspan; - r = fz_intersect_bbox(r, fz_bound_pixmap(dest)); + r = fz_intersect_bbox(r, fz_pixmap_bbox(ctx, dest)); w = r.x1 - r.x0; y = r.y1 - r.y0; if (w <= 0 || y <= 0) @@ -261,7 +272,7 @@ fz_alpha_from_gray(fz_context *ctx, fz_pixmap *gray, int luminosity) assert(gray->n == 2); - alpha = fz_new_pixmap_with_bbox(ctx, NULL, fz_bound_pixmap(gray)); + alpha = fz_new_pixmap_with_bbox(ctx, NULL, fz_pixmap_bbox(ctx, gray)); dp = alpha->samples; sp = gray->samples; if (!luminosity) |