Nikolay Sivov : dwrite: Avoid repeated method calls during run rendering.
Alexandre Julliard
julliard at winehq.org
Tue Jul 11 15:59:32 CDT 2017
Module: wine
Branch: master
Commit: 18fe44c7af612d02711631c100360114c6a6d09e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=18fe44c7af612d02711631c100360114c6a6d09e
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Jul 11 16:57:40 2017 +0300
dwrite: Avoid repeated method calls during run rendering.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dwrite/dwrite_private.h | 1 +
dlls/dwrite/font.c | 2 ++
dlls/dwrite/freetype.c | 11 ++++-------
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 7694b79..9530399 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -260,6 +260,7 @@ extern WCHAR bidi_get_mirrored_char(WCHAR) DECLSPEC_HIDDEN;
/* FreeType integration */
struct dwrite_glyphbitmap {
IDWriteFontFace4 *fontface;
+ DWORD simulations;
FLOAT emsize;
BOOL nohint;
UINT16 index;
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 0332587..114833a 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -4862,6 +4862,7 @@ static void glyphrunanalysis_get_texturebounds(struct dwrite_glyphrunanalysis *a
memset(&glyph_bitmap, 0, sizeof(glyph_bitmap));
glyph_bitmap.fontface = fontface;
+ glyph_bitmap.simulations = IDWriteFontFace4_GetSimulations(fontface);
glyph_bitmap.emsize = analysis->run.fontEmSize;
glyph_bitmap.nohint = is_natural_rendering_mode(analysis->rendering_mode);
if (analysis->flags & RUNANALYSIS_USE_TRANSFORM)
@@ -4954,6 +4955,7 @@ static HRESULT glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis)
memset(&glyph_bitmap, 0, sizeof(glyph_bitmap));
glyph_bitmap.fontface = fontface;
+ glyph_bitmap.simulations = IDWriteFontFace4_GetSimulations(fontface);
glyph_bitmap.emsize = analysis->run.fontEmSize;
glyph_bitmap.nohint = is_natural_rendering_mode(analysis->rendering_mode);
glyph_bitmap.type = analysis->texture_type;
diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c
index 2ad513e..934ca80 100644
--- a/dlls/dwrite/freetype.c
+++ b/dlls/dwrite/freetype.c
@@ -636,7 +636,6 @@ static BOOL is_face_scalable(IDWriteFontFace4 *fontface)
static BOOL get_glyph_transform(struct dwrite_glyphbitmap *bitmap, FT_Matrix *ret)
{
- USHORT simulations = IDWriteFontFace4_GetSimulations(bitmap->fontface);
FT_Matrix m;
ret->xx = 1 << 16;
@@ -646,10 +645,10 @@ static BOOL get_glyph_transform(struct dwrite_glyphbitmap *bitmap, FT_Matrix *re
/* Some fonts provide mostly bitmaps and very few outlines, for example for .notdef.
Disable transform if that's the case. */
- if (!is_face_scalable(bitmap->fontface) || (!bitmap->m && simulations == 0))
+ if (!is_face_scalable(bitmap->fontface) || (!bitmap->m && bitmap->simulations == 0))
return FALSE;
- if (simulations & DWRITE_FONT_SIMULATIONS_OBLIQUE) {
+ if (bitmap->simulations & DWRITE_FONT_SIMULATIONS_OBLIQUE) {
m.xx = 1 << 16;
m.xy = (1 << 16) / 3;
m.yx = 0;
@@ -667,7 +666,6 @@ static BOOL get_glyph_transform(struct dwrite_glyphbitmap *bitmap, FT_Matrix *re
void freetype_get_glyph_bbox(struct dwrite_glyphbitmap *bitmap)
{
- USHORT simulations = IDWriteFontFace4_GetSimulations(bitmap->fontface);
FTC_ImageTypeRec imagetype;
FT_BBox bbox = { 0 };
BOOL needs_transform;
@@ -688,7 +686,7 @@ void freetype_get_glyph_bbox(struct dwrite_glyphbitmap *bitmap)
FT_Glyph glyph_copy;
if (pFT_Glyph_Copy(glyph, &glyph_copy) == 0) {
- if (simulations & DWRITE_FONT_SIMULATIONS_BOLD)
+ if (bitmap->simulations & DWRITE_FONT_SIMULATIONS_BOLD)
embolden_glyph(glyph_copy, bitmap->emsize);
/* Includes oblique and user transform. */
@@ -826,7 +824,6 @@ static BOOL freetype_get_aa_glyph_bitmap(struct dwrite_glyphbitmap *bitmap, FT_G
BOOL freetype_get_glyph_bitmap(struct dwrite_glyphbitmap *bitmap)
{
- USHORT simulations = IDWriteFontFace4_GetSimulations(bitmap->fontface);
FTC_ImageTypeRec imagetype;
BOOL needs_transform;
BOOL ret = FALSE;
@@ -847,7 +844,7 @@ BOOL freetype_get_glyph_bitmap(struct dwrite_glyphbitmap *bitmap)
if (needs_transform) {
if (pFT_Glyph_Copy(glyph, &glyph_copy) == 0) {
- if (simulations & DWRITE_FONT_SIMULATIONS_BOLD)
+ if (bitmap->simulations & DWRITE_FONT_SIMULATIONS_BOLD)
embolden_glyph(glyph_copy, bitmap->emsize);
/* Includes oblique and user transform. */
More information about the wine-cvs
mailing list