summaryrefslogtreecommitdiff
path: root/include/mupdf/fitz/glyph.h
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-06-25 13:15:50 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-07-05 15:32:34 +0200
commit4a99615a609eec2b84bb2341d74fac46a5998137 (patch)
tree486eacff07448e4c655df1fa1bcb20df709dd8df /include/mupdf/fitz/glyph.h
parent2aa62902447760764e7a763dea322145d9c4808c (diff)
downloadmupdf-4a99615a609eec2b84bb2341d74fac46a5998137.tar.xz
Pass rect and matrix by value in geometry functions.
Several things irk me about passing values as const pointers: * They can be NULL, which is not a valid value. * They require explicit temporary variables for storage. * They don't compose easily in a legible manner, requiring weird pointer passing semantics where the variable being assigned is hidden as an argument in the innermost function call. * We can't change the value through the pointer, requiring yet more local variables to hold copies of the input value. In the device interface where we pass a matrix to a function, we often find ourselves making a local copy of the matrix so we can concatenate other transforms to it. This copying is a lot of unnecessary busywork that I hope to eventually avoid by laying the groundwork with this commit. This is a rather large API change, so I apologize for the inconvenience, but I hope the end result and gain in legibility will be worth the pain.
Diffstat (limited to 'include/mupdf/fitz/glyph.h')
-rw-r--r--include/mupdf/fitz/glyph.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/mupdf/fitz/glyph.h b/include/mupdf/fitz/glyph.h
index 4b2bfdbb..1f697e5e 100644
--- a/include/mupdf/fitz/glyph.h
+++ b/include/mupdf/fitz/glyph.h
@@ -16,7 +16,7 @@ typedef struct fz_glyph_s fz_glyph;
/*
fz_glyph_bbox: Return the bounding box for a glyph.
*/
-fz_irect *fz_glyph_bbox(fz_context *ctx, fz_glyph *glyph, fz_irect *bbox);
+fz_irect fz_glyph_bbox(fz_context *ctx, fz_glyph *glyph);
/*
fz_glyph_width: Return the width of the glyph in pixels.
@@ -120,7 +120,7 @@ struct fz_glyph_s
unsigned char data[1];
};
-fz_irect *fz_glyph_bbox_no_ctx(fz_glyph *src, fz_irect *bbox);
+fz_irect fz_glyph_bbox_no_ctx(fz_glyph *src);
static inline size_t
fz_glyph_size(fz_context *ctx, fz_glyph *glyph)