summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/pdfapp.c2
-rw-r--r--apps/x11_main.c5
-rw-r--r--draw/draw_blend.c4
-rw-r--r--draw/draw_device.c16
-rw-r--r--draw/draw_paint.c14
-rw-r--r--fitz/fitz-internal.h2
-rw-r--r--fitz/fitz.h6
-rw-r--r--fitz/image_save.c2
-rw-r--r--fitz/res_colorspace.c2
-rw-r--r--fitz/res_pixmap.c21
-rw-r--r--pdf/pdf_colorspace.c2
11 files changed, 44 insertions, 32 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 59b2f18d..0afd5d15 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -904,7 +904,7 @@ void pdfapp_onkey(pdfapp_t *app, int c)
void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int state)
{
- fz_bbox rect = fz_bound_pixmap(app->image);
+ fz_bbox rect = fz_pixmap_bbox(app->ctx, app->image);
fz_link *link;
fz_matrix ctm;
fz_point p;
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 6ee76788..447ebeb2 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -336,9 +336,8 @@ static void winblitsearch(pdfapp_t *app)
static void winblit(pdfapp_t *app)
{
- fz_bbox bb = fz_bound_pixmap(gapp.image);
- int image_w = bb.x1 - bb.x0;
- int image_h = bb.y1 - bb.y0;
+ int image_w = fz_pixmap_width(gapp.ctx, gapp.image);
+ int image_h = fz_pixmap_height(gapp.ctx, gapp.image);
int image_n = fz_pixmap_components(gapp.ctx, gapp.image);
unsigned char *image_samples = fz_pixmap_samples(gapp.ctx, gapp.image);
int x0 = gapp.panx;
diff --git a/draw/draw_blend.c b/draw/draw_blend.c
index 904de768..7c74df79 100644
--- a/draw/draw_blend.c
+++ b/draw/draw_blend.c
@@ -589,8 +589,8 @@ fz_blend_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha, int blendmode, int is
}
}
- bbox = fz_bound_pixmap(dst);
- bbox = fz_intersect_bbox(bbox, fz_bound_pixmap(src));
+ bbox = fz_pixmap_bbox_no_ctx(dst);
+ bbox = fz_intersect_bbox(bbox, fz_pixmap_bbox_no_ctx(src));
x = bbox.x0;
y = bbox.y0;
diff --git a/draw/draw_device.c b/draw/draw_device.c
index ec4e2df5..76f934bd 100644
--- a/draw/draw_device.c
+++ b/draw/draw_device.c
@@ -121,7 +121,7 @@ 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_bbox(dev->ctx, state->dest->colorspace, bbox);
@@ -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;
@@ -890,7 +890,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, fz_matrix ctm, float alpha)
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);
@@ -926,7 +926,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, fz_matrix ctm, float alpha)
if (pixmap->colorspace != model && !after)
{
- converted = fz_new_pixmap_with_bbox(ctx, model, fz_bound_pixmap(pixmap));
+ converted = fz_new_pixmap_with_bbox(ctx, model, fz_pixmap_bbox(ctx, pixmap));
fz_convert_pixmap(ctx, converted, pixmap);
pixmap = converted;
}
@@ -956,7 +956,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, fz_matrix ctm, float alpha)
}
else
{
- converted = fz_new_pixmap_with_bbox(ctx, model, fz_bound_pixmap(pixmap));
+ converted = fz_new_pixmap_with_bbox(ctx, model, fz_pixmap_bbox(ctx, pixmap));
fz_convert_pixmap(ctx, converted, pixmap);
pixmap = converted;
}
@@ -994,7 +994,7 @@ fz_draw_fill_image_mask(fz_device *devp, fz_image *image, fz_matrix ctm,
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);
@@ -1065,7 +1065,7 @@ fz_draw_clip_image_mask(fz_device *devp, fz_image *image, fz_rect *rect, fz_matr
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);
@@ -1284,7 +1284,7 @@ fz_draw_end_mask(fz_device *devp)
state[1].mask = NULL;
/* create new dest scratch buffer */
- bbox = fz_bound_pixmap(temp);
+ bbox = fz_pixmap_bbox(ctx, temp);
dest = fz_new_pixmap_with_bbox(dev->ctx, state->dest->colorspace, bbox);
fz_clear_pixmap(dev->ctx, dest);
diff --git a/draw/draw_paint.c b/draw/draw_paint.c
index 6a73783b..2a5f9607 100644
--- a/draw/draw_paint.c
+++ b/draw/draw_paint.c
@@ -382,8 +382,8 @@ fz_paint_pixmap_with_rect(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_bbox bbo
assert(dst->n == src->n);
- bbox = fz_intersect_bbox(bbox, fz_bound_pixmap(dst));
- bbox = fz_intersect_bbox(bbox, fz_bound_pixmap(src));
+ bbox = fz_intersect_bbox(bbox, fz_pixmap_bbox_no_ctx(dst));
+ bbox = fz_intersect_bbox(bbox, fz_pixmap_bbox_no_ctx(src));
x = bbox.x0;
y = bbox.y0;
@@ -413,8 +413,8 @@ fz_paint_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha)
assert(dst->n == src->n);
- bbox = fz_bound_pixmap(dst);
- bbox = fz_intersect_bbox(bbox, fz_bound_pixmap(src));
+ bbox = fz_pixmap_bbox_no_ctx(dst);
+ bbox = fz_intersect_bbox(bbox, fz_pixmap_bbox_no_ctx(src));
x = bbox.x0;
y = bbox.y0;
@@ -445,9 +445,9 @@ fz_paint_pixmap_with_mask(fz_pixmap *dst, fz_pixmap *src, fz_pixmap *msk)
assert(dst->n == src->n);
assert(msk->n == 1);
- bbox = fz_bound_pixmap(dst);
- bbox = fz_intersect_bbox(bbox, fz_bound_pixmap(src));
- bbox = fz_intersect_bbox(bbox, fz_bound_pixmap(msk));
+ bbox = fz_pixmap_bbox_no_ctx(dst);
+ bbox = fz_intersect_bbox(bbox, fz_pixmap_bbox_no_ctx(src));
+ bbox = fz_intersect_bbox(bbox, fz_pixmap_bbox_no_ctx(msk));
x = bbox.x0;
y = bbox.y0;
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)
diff --git a/pdf/pdf_colorspace.c b/pdf/pdf_colorspace.c
index f195fa08..ee5bc5fc 100644
--- a/pdf/pdf_colorspace.c
+++ b/pdf/pdf_colorspace.c
@@ -193,7 +193,7 @@ pdf_expand_indexed_pixmap(fz_context *ctx, fz_pixmap *src)
lookup = idx->lookup;
n = idx->base->n;
- dst = fz_new_pixmap_with_bbox(ctx, idx->base, fz_bound_pixmap(src));
+ dst = fz_new_pixmap_with_bbox(ctx, idx->base, fz_pixmap_bbox(ctx, src));
s = src->samples;
d = dst->samples;