summaryrefslogtreecommitdiff
path: root/source/fitz/font.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-08-28 15:18:37 +0100
committerRobin Watts <robin.watts@artifex.com>2013-09-02 11:40:13 +0100
commitda277059b37380d57028ff79a636f4d725c96e8f (patch)
tree21140720e22a819b863a64160fca6a4dec2be714 /source/fitz/font.c
parent2b2c67836932b1dada7f7f28e42fe4ed06c4e4ed (diff)
downloadmupdf-da277059b37380d57028ff79a636f4d725c96e8f.tar.xz
Be smarter when quantising sub pixel positions for glyphs.
For large glyphs, sub pixel positioning is supremely unimportant. Even for smaller glyphs, we don't need 5*5 possible sub pixel positions. Base the degree of sub pixel quantisation on the size of the glyphs. This should result in better cache use. We push all the glyph sub positioning logic into fz_render_glyph (and fz_render_stroked_glyph). This simplifies the calling code. We also tweak fz_render_glyph so that it updates the transform it is called with to reflect the sub pixel positioning. This solves various problems: Firstly, we can round positions both up and down to achieve a smaller net displacement (e.g. (0.99, 0.99) can go to (1,1) rather than (0.75, 0.75) if we have a subpixel position resolution of 1/4 pixels). Secondly, glyphs that are drawn from outlines will have exactly the same subpixel changes applied. This is unlikely to be noticable, but it does mean that baselines should avoid having any shifts in them. Finally, it enables us to avoid lots of unnecessary copying of matrices, hopefully reducing overhead.
Diffstat (limited to 'source/fitz/font.c')
-rw-r--r--source/fitz/font.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/fitz/font.c b/source/fitz/font.c
index 1f44d096..1aeab3a6 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -934,7 +934,7 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm,
}
fz_glyph *
-fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, fz_irect scissor)
+fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor)
{
fz_display_list *list;
fz_matrix ctm;
@@ -970,7 +970,7 @@ fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm
fz_expand_rect(fz_bound_glyph(ctx, font, gid, trm, &bounds), 1);
fz_irect_from_rect(&bbox, &bounds);
- fz_intersect_irect(&bbox, &scissor);
+ fz_intersect_irect(&bbox, scissor);
glyph = fz_new_pixmap_with_bbox(ctx, model ? model : fz_device_gray(ctx), &bbox);
fz_clear_pixmap(ctx, glyph);