Commit 18fe44c7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Avoid repeated method calls during run rendering.

parent 8810c88a
......@@ -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;
......
......@@ -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;
......
......@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment