diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-06-25 13:15:50 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-07-05 15:32:34 +0200 |
commit | 4a99615a609eec2b84bb2341d74fac46a5998137 (patch) | |
tree | 486eacff07448e4c655df1fa1bcb20df709dd8df /source/fitz/draw-imp.h | |
parent | 2aa62902447760764e7a763dea322145d9c4808c (diff) | |
download | mupdf-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 'source/fitz/draw-imp.h')
-rw-r--r-- | source/fitz/draw-imp.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/fitz/draw-imp.h b/source/fitz/draw-imp.h index 9c160e6e..eb3e36d2 100644 --- a/source/fitz/draw-imp.h +++ b/source/fitz/draw-imp.h @@ -267,7 +267,7 @@ static inline void fz_drop_rasterizer(fz_context *ctx, fz_rasterizer *r) After this, the edges should be 'inserted' into the rasterizer. */ -int fz_reset_rasterizer(fz_context *ctx, fz_rasterizer *r, const fz_irect *clip); +int fz_reset_rasterizer(fz_context *ctx, fz_rasterizer *r, fz_irect clip); /* fz_insert_rasterizer: Insert an edge into a rasterizer. @@ -342,13 +342,13 @@ static inline void fz_postindex_rasterizer(fz_context *ctx, fz_rasterizer *r) fz_bound_rasterizer: Once a set of edges has been fed into a rasterizer, the (device space) bounding box can be retrieved. */ -fz_irect *fz_bound_rasterizer(fz_context *ctx, const fz_rasterizer *rast, fz_irect *bbox); +fz_irect fz_bound_rasterizer(fz_context *ctx, const fz_rasterizer *rast); /* fz_scissor_rasterizer: Retrieve the clipping box with which the rasterizer was reset. */ -fz_rect *fz_scissor_rasterizer(fz_context *ctx, const fz_rasterizer *rast, fz_rect *r); +fz_rect fz_scissor_rasterizer(fz_context *ctx, const fz_rasterizer *rast); /* fz_convert_rasterizer: Convert the set of edges that have |