From 5060043a33b32dfdd8ffacc88e8ca05b5e8271a9 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 12 Mar 2012 16:34:00 +0000 Subject: Store AA level used to render a glyph in the glyphcache. In the existing code, glyphs are stored/retrieved from the glyphcache with no reference to the antialias level used to create them. This means that if we are using different aa levels in different threads, we can retrieve 'non-matching' glyphs and hence get rendering indeterminisms. Fixed simply here by storing the aa level in the glyphcache too. --- fitz/fitz.h | 2 +- fitz/res_font.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'fitz') diff --git a/fitz/fitz.h b/fitz/fitz.h index 6427537f..1ec1eb97 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -1747,7 +1747,7 @@ fz_glyph_cache *fz_keep_glyph_cache(fz_context *ctx); void fz_drop_glyph_cache_context(fz_context *ctx); void fz_purge_glyph_cache(fz_context *ctx); -fz_pixmap *fz_render_ft_glyph(fz_context *ctx, fz_font *font, int cid, fz_matrix trm); +fz_pixmap *fz_render_ft_glyph(fz_context *ctx, fz_font *font, int cid, fz_matrix trm, int aa); fz_pixmap *fz_render_t3_glyph(fz_context *ctx, fz_font *font, int cid, fz_matrix trm, fz_colorspace *model); fz_pixmap *fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz_stroke_state *state); fz_pixmap *fz_render_glyph(fz_context *ctx, fz_font*, int, fz_matrix, fz_colorspace *model); diff --git a/fitz/res_font.c b/fitz/res_font.c index e4a4d23a..f6207e80 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -387,7 +387,7 @@ fz_copy_ft_bitmap(fz_context *ctx, int left, int top, FT_Bitmap *bitmap) /* The glyph cache lock is always taken when this is called. */ fz_pixmap * -fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm) +fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, int aa) { FT_Face face = font->ft_face; FT_Matrix m; @@ -421,7 +421,7 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm) fz_warn(ctx, "freetype setting character size: %s", ft_error_string(fterr)); FT_Set_Transform(face, &m, &v); - if (fz_get_aa_level(ctx) == 0) + if (aa == 0) { /* If you really want grid fitting, enable this code. */ float scale = fz_matrix_expansion(trm); -- cgit v1.2.3