From 16152993d6406f1c2d134fc65d978976768cdb6c Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 5 Dec 2019 11:55:59 +0300 Subject: [PATCH] dwrite: Use IDWriteFactory7 internall for fontfaces. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dwrite/dwrite_private.h | 10 +++++----- dlls/dwrite/font.c | 11 ++++++----- dlls/dwrite/main.c | 14 +++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index a5d946c385c..1598bb6aee4 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -154,7 +154,7 @@ struct glyphrunanalysis_desc struct fontface_desc { - IDWriteFactory5 *factory; + IDWriteFactory7 *factory; DWRITE_FONT_FACE_TYPE face_type; IDWriteFontFile * const *files; IDWriteFontFileStream *stream; @@ -193,7 +193,7 @@ struct dwrite_fontface UINT32 file_count; UINT32 index; - IDWriteFactory5 *factory; + IDWriteFactory7 *factory; struct fontfacecached *cached; USHORT simulations; @@ -268,7 +268,7 @@ extern HRESULT factory_get_cached_fontface(IDWriteFactory5*,IDWriteFontFile*cons struct list**,REFIID,void**) DECLSPEC_HIDDEN; extern void factory_detach_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollection3 *collection) DECLSPEC_HIDDEN; extern void factory_detach_gdiinterop(IDWriteFactory5*,IDWriteGdiInterop1*) DECLSPEC_HIDDEN; -extern struct fontfacecached *factory_cache_fontface(IDWriteFactory5 *factory, struct list *fontfaces, +extern struct fontfacecached *factory_cache_fontface(IDWriteFactory7 *factory, struct list *fontfaces, IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; extern void get_logfont_from_font(IDWriteFont*,LOGFONTW*) DECLSPEC_HIDDEN; extern void get_logfont_from_fontface(IDWriteFontFace*,LOGFONTW*) DECLSPEC_HIDDEN; @@ -276,8 +276,8 @@ extern HRESULT get_fontsig_from_font(IDWriteFont*,FONTSIGNATURE*) DECLSPEC_HIDDE extern HRESULT get_fontsig_from_fontface(IDWriteFontFace*,FONTSIGNATURE*) DECLSPEC_HIDDEN; extern HRESULT create_gdiinterop(IDWriteFactory5*,IDWriteGdiInterop1**) DECLSPEC_HIDDEN; extern void fontface_detach_from_cache(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; -extern void factory_lock(IDWriteFactory5*) DECLSPEC_HIDDEN; -extern void factory_unlock(IDWriteFactory5*) DECLSPEC_HIDDEN; +extern void factory_lock(IDWriteFactory7 *factory) DECLSPEC_HIDDEN; +extern void factory_unlock(IDWriteFactory7 *factory) DECLSPEC_HIDDEN; extern HRESULT create_inmemory_fileloader(IDWriteFontFileLoader**) DECLSPEC_HIDDEN; extern HRESULT create_font_resource(IDWriteFactory7 *factory, IDWriteFontFile *file, UINT32 face_index, IDWriteFontResource **resource) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index bfe32d5fd93..8c58d7561a9 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -551,7 +551,7 @@ static ULONG WINAPI dwritefontface_Release(IDWriteFontFace5 *iface) freetype_notify_cacheremove(iface); - IDWriteFactory5_Release(fontface->factory); + IDWriteFactory7_Release(fontface->factory); heap_free(fontface); } @@ -1518,7 +1518,7 @@ static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace5 if (FAILED(hr = get_filestream_from_file(data->file, &desc.stream))) return hr; - desc.factory = font->family->collection->factory; + desc.factory = (IDWriteFactory7 *)font->family->collection->factory; desc.face_type = data->face_type; desc.files = &data->file; desc.files_number = 1; @@ -4051,7 +4051,7 @@ HRESULT create_font_collection(IDWriteFactory5 *factory, IDWriteFontFileEnumerat WCHAR familyW[255]; UINT32 index; - desc.factory = factory; + desc.factory = (IDWriteFactory7 *)factory; desc.face_type = face_type; desc.files = &file; desc.stream = stream; @@ -4394,7 +4394,7 @@ static HRESULT eudc_collection_add_family(IDWriteFactory5 *factory, struct dwrit struct fontface_desc desc; /* alloc and init new font data structure */ - desc.factory = factory; + desc.factory = (IDWriteFactory7 *)factory; desc.face_type = face_type; desc.index = i; desc.files = &file; @@ -4660,7 +4660,8 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li fontface->colr.exists = TRUE; fontface->index = desc->index; fontface->simulations = desc->simulations; - IDWriteFactory5_AddRef(fontface->factory = desc->factory); + fontface->factory = desc->factory; + IDWriteFactory7_AddRef(fontface->factory); for (i = 0; i < fontface->file_count; i++) { fontface->files[i] = desc->files[i]; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 1c1fabdb7d2..e4b76823ff1 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -847,15 +847,15 @@ static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory return create_font_file(loader, reference_key, key_size, font_file); } -void factory_lock(IDWriteFactory5 *iface) +void factory_lock(IDWriteFactory7 *iface) { - struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); EnterCriticalSection(&factory->cs); } -void factory_unlock(IDWriteFactory5 *iface) +void factory_unlock(IDWriteFactory7 *iface) { - struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); LeaveCriticalSection(&factory->cs); } @@ -935,10 +935,10 @@ HRESULT factory_get_cached_fontface(IDWriteFactory5 *iface, IDWriteFontFile * co return *obj ? S_OK : S_FALSE; } -struct fontfacecached *factory_cache_fontface(IDWriteFactory5 *iface, struct list *fontfaces, +struct fontfacecached *factory_cache_fontface(IDWriteFactory7 *iface, struct list *fontfaces, IDWriteFontFace5 *fontface) { - struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); struct fontfacecached *cached; /* new cache entry */ @@ -1006,7 +1006,7 @@ static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory7 *iface, DWRIT if (hr != S_FALSE) goto failed; - desc.factory = (IDWriteFactory5 *)iface; + desc.factory = iface; desc.face_type = req_facetype; desc.files = font_files; desc.stream = stream;