summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-01-30 14:05:56 +0100
committerTor Andersson <tor.andersson@artifex.com>2013-01-30 14:13:01 +0100
commit29f7d13d37022303c5d93ddd2942f6b87959f432 (patch)
tree0f1eeb4f3778713fe99b34649336aa27ddaf9a71 /fitz
parent01e2ccf6ade55cc20e83b80bad81fef6627c9a05 (diff)
downloadmupdf-29f7d13d37022303c5d93ddd2942f6b87959f432.tar.xz
Always pass value structs (rect, matrix, etc) as values not by pointer.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/dev_list.c4
-rw-r--r--fitz/fitz-internal.h4
-rw-r--r--fitz/fitz.h2
-rw-r--r--fitz/res_path.c21
4 files changed, 17 insertions, 14 deletions
diff --git a/fitz/dev_list.c b/fitz/dev_list.c
index 55ef4e7d..2e6822e3 100644
--- a/fitz/dev_list.c
+++ b/fitz/dev_list.c
@@ -334,7 +334,7 @@ fz_list_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke, fz_m
fz_try(ctx)
{
node->rect = fz_bound_text(dev->ctx, text, ctm);
- fz_adjust_rect_for_stroke(&node->rect, stroke, &ctm);
+ node->rect = fz_adjust_rect_for_stroke(node->rect, stroke, ctm);
node->item.text = fz_clone_text(dev->ctx, text);
node->stroke = fz_keep_stroke_state(dev->ctx, stroke);
}
@@ -378,7 +378,7 @@ fz_list_clip_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke,
fz_try(ctx)
{
node->rect = fz_bound_text(dev->ctx, text, ctm);
- fz_adjust_rect_for_stroke(&node->rect, stroke, &ctm);
+ node->rect = fz_adjust_rect_for_stroke(node->rect, stroke, ctm);
node->item.text = fz_clone_text(dev->ctx, text);
node->stroke = fz_keep_stroke_state(dev->ctx, stroke);
}
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index 518ed8c2..0f6b70c3 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -300,7 +300,7 @@ static inline int fz_mul255(int a, int b)
* AMOUNT (in the 0...256 range). */
#define FZ_BLEND(SRC, DST, AMOUNT) ((((SRC)-(DST))*(AMOUNT) + ((DST)<<8))>>8)
-void fz_gridfit_matrix(fz_matrix *m);
+fz_matrix fz_gridfit_matrix(fz_matrix m);
float fz_matrix_max_expansion(fz_matrix m);
/*
@@ -1162,7 +1162,7 @@ void fz_transform_path(fz_context *ctx, fz_path *path, fz_matrix transform);
fz_path *fz_clone_path(fz_context *ctx, fz_path *old);
fz_rect fz_bound_path(fz_context *ctx, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm);
-void fz_adjust_rect_for_stroke(fz_rect *r, fz_stroke_state *stroke, fz_matrix *ctm);
+fz_rect fz_adjust_rect_for_stroke(fz_rect r, fz_stroke_state *stroke, fz_matrix ctm);
fz_stroke_state *fz_new_stroke_state(fz_context *ctx);
fz_stroke_state *fz_new_stroke_state_with_len(fz_context *ctx, int len);
diff --git a/fitz/fitz.h b/fitz/fitz.h
index f3fd7458..71f9f214 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -2653,7 +2653,7 @@ int fz_widget_get_type(fz_widget *widget);
/*
fz_widget_bbox: get the bounding box of a widget.
*/
-fz_rect *fz_widget_bbox(fz_widget *widget);
+fz_rect fz_widget_bbox(fz_widget *widget);
/*
fz_text_widget_text: Get the text currently displayed in
diff --git a/fitz/res_path.c b/fitz/res_path.c
index a030cc29..0f18b482 100644
--- a/fitz/res_path.c
+++ b/fitz/res_path.c
@@ -309,29 +309,32 @@ fz_bound_path(fz_context *ctx, fz_path *path, fz_stroke_state *stroke, fz_matrix
if (stroke)
{
- fz_adjust_rect_for_stroke(&r, stroke, &ctm);
+ r = fz_adjust_rect_for_stroke(r, stroke, ctm);
}
return r;
}
-void
-fz_adjust_rect_for_stroke(fz_rect *r, fz_stroke_state *stroke, fz_matrix *ctm)
+fz_rect
+fz_adjust_rect_for_stroke(fz_rect r, fz_stroke_state *stroke, fz_matrix ctm)
{
float expand;
if (!stroke)
- return;
+ return r;
+
expand = stroke->linewidth;
if (expand == 0)
expand = 1.0f;
- expand *= fz_matrix_max_expansion(*ctm);
+ expand *= fz_matrix_max_expansion(ctm);
if ((stroke->linejoin == FZ_LINEJOIN_MITER || stroke->linejoin == FZ_LINEJOIN_MITER_XPS) && stroke->miterlimit > 1)
expand *= stroke->miterlimit;
- r->x0 -= expand;
- r->y0 -= expand;
- r->x1 += expand;
- r->y1 += expand;
+
+ r.x0 -= expand;
+ r.y0 -= expand;
+ r.x1 += expand;
+ r.y1 += expand;
+ return r;
}
void