[PATCH 4/4] dwrite: Update to IDWriteGdiInterop1

Nikolay Sivov nsivov at codeweavers.com
Tue Apr 19 01:39:28 CDT 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/dwrite/dwrite_private.h |   4 +-
 dlls/dwrite/gdiinterop.c     | 100 +++++++++++++++++++++++++++++++------------
 dlls/dwrite/main.c           |   4 +-
 include/dwrite_3.idl         |  25 +++++++++++
 4 files changed, 101 insertions(+), 32 deletions(-)

diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 5c8880a..03a31b0 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -120,8 +120,8 @@ extern HRESULT create_gdicompat_textlayout(IDWriteFactory3*,const WCHAR*,UINT32,
     const DWRITE_MATRIX*,BOOL,IDWriteTextLayout**) DECLSPEC_HIDDEN;
 extern HRESULT create_trimmingsign(IDWriteFactory3*,IDWriteTextFormat*,IDWriteInlineObject**) DECLSPEC_HIDDEN;
 extern HRESULT create_typography(IDWriteTypography**) DECLSPEC_HIDDEN;
-extern HRESULT create_gdiinterop(IDWriteFactory3*,IDWriteGdiInterop**) DECLSPEC_HIDDEN;
-extern void    release_gdiinterop(IDWriteGdiInterop*) DECLSPEC_HIDDEN;
+extern HRESULT create_gdiinterop(IDWriteFactory3*,IDWriteGdiInterop1**) DECLSPEC_HIDDEN;
+extern void    release_gdiinterop(IDWriteGdiInterop1*) DECLSPEC_HIDDEN;
 extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN;
 extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
 extern HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings) DECLSPEC_HIDDEN;
diff --git a/dlls/dwrite/gdiinterop.c b/dlls/dwrite/gdiinterop.c
index 3585cd7..711b95e 100644
--- a/dlls/dwrite/gdiinterop.c
+++ b/dlls/dwrite/gdiinterop.c
@@ -33,7 +33,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
 
 struct gdiinterop {
-    IDWriteGdiInterop IDWriteGdiInterop_iface;
+    IDWriteGdiInterop1 IDWriteGdiInterop1_iface;
     IDWriteFactory3 *factory;
 };
 
@@ -105,9 +105,9 @@ static inline struct rendertarget *impl_from_ID2D1SimplifiedGeometrySink(ID2D1Si
     return CONTAINING_RECORD(iface, struct rendertarget, ID2D1SimplifiedGeometrySink_iface);
 }
 
-static inline struct gdiinterop *impl_from_IDWriteGdiInterop(IDWriteGdiInterop *iface)
+static inline struct gdiinterop *impl_from_IDWriteGdiInterop1(IDWriteGdiInterop1 *iface)
 {
-    return CONTAINING_RECORD(iface, struct gdiinterop, IDWriteGdiInterop_iface);
+    return CONTAINING_RECORD(iface, struct gdiinterop, IDWriteGdiInterop1_iface);
 }
 
 static HRESULT WINAPI rendertarget_sink_QueryInterface(ID2D1SimplifiedGeometrySink *iface, REFIID riid, void **obj)
@@ -583,17 +583,18 @@ static HRESULT create_rendertarget(IDWriteFactory *factory, HDC hdc, UINT32 widt
     return S_OK;
 }
 
-static HRESULT WINAPI gdiinterop_QueryInterface(IDWriteGdiInterop *iface, REFIID riid, void **obj)
+static HRESULT WINAPI gdiinterop_QueryInterface(IDWriteGdiInterop1 *iface, REFIID riid, void **obj)
 {
-    struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
 
     TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
 
-    if (IsEqualIID(riid, &IID_IDWriteGdiInterop) ||
+    if (IsEqualIID(riid, &IID_IDWriteGdiInterop1) ||
+        IsEqualIID(riid, &IID_IDWriteGdiInterop) ||
         IsEqualIID(riid, &IID_IUnknown))
     {
         *obj = iface;
-        IDWriteGdiInterop_AddRef(iface);
+        IDWriteGdiInterop1_AddRef(iface);
         return S_OK;
     }
 
@@ -601,24 +602,24 @@ static HRESULT WINAPI gdiinterop_QueryInterface(IDWriteGdiInterop *iface, REFIID
     return E_NOINTERFACE;
 }
 
-static ULONG WINAPI gdiinterop_AddRef(IDWriteGdiInterop *iface)
+static ULONG WINAPI gdiinterop_AddRef(IDWriteGdiInterop1 *iface)
 {
-    struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
     TRACE("(%p)\n", This);
     return IDWriteFactory3_AddRef(This->factory);
 }
 
-static ULONG WINAPI gdiinterop_Release(IDWriteGdiInterop *iface)
+static ULONG WINAPI gdiinterop_Release(IDWriteGdiInterop1 *iface)
 {
-    struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
     TRACE("(%p)\n", This);
     return IDWriteFactory3_Release(This->factory);
 }
 
-static HRESULT WINAPI gdiinterop_CreateFontFromLOGFONT(IDWriteGdiInterop *iface,
+static HRESULT WINAPI gdiinterop_CreateFontFromLOGFONT(IDWriteGdiInterop1 *iface,
     LOGFONTW const *logfont, IDWriteFont **font)
 {
-    struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
     IDWriteFontCollection *collection;
     IDWriteFontFamily *family;
     DWRITE_FONT_STYLE style;
@@ -662,10 +663,10 @@ done:
     return hr;
 }
 
-static HRESULT WINAPI gdiinterop_ConvertFontToLOGFONT(IDWriteGdiInterop *iface,
+static HRESULT WINAPI gdiinterop_ConvertFontToLOGFONT(IDWriteGdiInterop1 *iface,
     IDWriteFont *font, LOGFONTW *logfont, BOOL *is_systemfont)
 {
-    struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
     static const WCHAR enusW[] = {'e','n','-','u','s',0};
     DWRITE_FONT_SIMULATIONS simulations;
     IDWriteFontCollection *collection;
@@ -718,11 +719,11 @@ static HRESULT WINAPI gdiinterop_ConvertFontToLOGFONT(IDWriteGdiInterop *iface,
     return hr;
 }
 
-static HRESULT WINAPI gdiinterop_ConvertFontFaceToLOGFONT(IDWriteGdiInterop *iface,
+static HRESULT WINAPI gdiinterop_ConvertFontFaceToLOGFONT(IDWriteGdiInterop1 *iface,
     IDWriteFontFace *fontface, LOGFONTW *logfont)
 {
     static const WCHAR enusW[] = {'e','n','-','u','s',0};
-    struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
     IDWriteLocalizedStrings *familynames;
     DWRITE_FONT_SIMULATIONS simulations;
     DWRITE_FONT_FACE_TYPE face_type;
@@ -803,10 +804,10 @@ struct font_fileinfo {
 extern BOOL WINAPI GetFontRealizationInfo(HDC hdc, struct font_realization_info *info);
 extern BOOL WINAPI GetFontFileInfo(DWORD instance_id, DWORD unknown, struct font_fileinfo *info, DWORD size, DWORD *needed);
 
-static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop *iface,
+static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop1 *iface,
     HDC hdc, IDWriteFontFace **fontface)
 {
-    struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
     struct font_realization_info info;
     struct font_fileinfo *fileinfo;
     DWRITE_FONT_FILE_TYPE filetype;
@@ -867,15 +868,54 @@ static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop *iface,
     return hr;
 }
 
-static HRESULT WINAPI gdiinterop_CreateBitmapRenderTarget(IDWriteGdiInterop *iface,
+static HRESULT WINAPI gdiinterop_CreateBitmapRenderTarget(IDWriteGdiInterop1 *iface,
     HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget **target)
 {
-    struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
     TRACE("(%p)->(%p %u %u %p)\n", This, hdc, width, height, target);
     return create_rendertarget((IDWriteFactory*)This->factory, hdc, width, height, target);
 }
 
-static const struct IDWriteGdiInteropVtbl gdiinteropvtbl = {
+static HRESULT WINAPI gdiinterop1_CreateFontFromLOGFONT(IDWriteGdiInterop1 *iface,
+    LOGFONTW const *logfont, IDWriteFontCollection *collection, IDWriteFont **font)
+{
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
+
+    FIXME("(%p)->(%p %p %p): stub\n", This, logfont, collection, font);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI gdiinterop1_GetFontSignature_(IDWriteGdiInterop1 *iface, IDWriteFontFace *fontface,
+    FONTSIGNATURE *fontsig)
+{
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
+
+    FIXME("(%p)->(%p %p): stub\n", This, fontface, fontsig);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI gdiinterop1_GetFontSignature(IDWriteGdiInterop1 *iface, IDWriteFont *font, FONTSIGNATURE *fontsig)
+{
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
+
+    FIXME("(%p)->(%p %p): stub\n", This, font, fontsig);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI gdiinterop1_GetMatchingFontsByLOGFONT(IDWriteGdiInterop1 *iface, LOGFONTW const *logfont,
+    IDWriteFontSet *fontset, IDWriteFontSet **subset)
+{
+    struct gdiinterop *This = impl_from_IDWriteGdiInterop1(iface);
+
+    FIXME("(%p)->(%p %p %p): stub\n", This, logfont, fontset, subset);
+
+    return E_NOTIMPL;
+}
+
+static const struct IDWriteGdiInterop1Vtbl gdiinteropvtbl = {
     gdiinterop_QueryInterface,
     gdiinterop_AddRef,
     gdiinterop_Release,
@@ -883,10 +923,14 @@ static const struct IDWriteGdiInteropVtbl gdiinteropvtbl = {
     gdiinterop_ConvertFontToLOGFONT,
     gdiinterop_ConvertFontFaceToLOGFONT,
     gdiinterop_CreateFontFaceFromHdc,
-    gdiinterop_CreateBitmapRenderTarget
+    gdiinterop_CreateBitmapRenderTarget,
+    gdiinterop1_CreateFontFromLOGFONT,
+    gdiinterop1_GetFontSignature_,
+    gdiinterop1_GetFontSignature,
+    gdiinterop1_GetMatchingFontsByLOGFONT
 };
 
-HRESULT create_gdiinterop(IDWriteFactory3 *factory, IDWriteGdiInterop **ret)
+HRESULT create_gdiinterop(IDWriteFactory3 *factory, IDWriteGdiInterop1 **ret)
 {
     struct gdiinterop *This;
 
@@ -895,15 +939,15 @@ HRESULT create_gdiinterop(IDWriteFactory3 *factory, IDWriteGdiInterop **ret)
     This = heap_alloc(sizeof(struct gdiinterop));
     if (!This) return E_OUTOFMEMORY;
 
-    This->IDWriteGdiInterop_iface.lpVtbl = &gdiinteropvtbl;
+    This->IDWriteGdiInterop1_iface.lpVtbl = &gdiinteropvtbl;
     This->factory = factory;
 
-    *ret= &This->IDWriteGdiInterop_iface;
+    *ret= &This->IDWriteGdiInterop1_iface;
     return S_OK;
 }
 
-void release_gdiinterop(IDWriteGdiInterop *iface)
+void release_gdiinterop(IDWriteGdiInterop1 *iface)
 {
-    struct gdiinterop *interop = impl_from_IDWriteGdiInterop(iface);
+    struct gdiinterop *interop = impl_from_IDWriteGdiInterop1(iface);
     heap_free(interop);
 }
diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c
index de60147..47f57d8 100644
--- a/dlls/dwrite/main.c
+++ b/dlls/dwrite/main.c
@@ -525,7 +525,7 @@ struct dwritefactory {
 
     IDWriteFontCollection *system_collection;
     IDWriteFontCollection *eudc_collection;
-    IDWriteGdiInterop *gdiinterop;
+    IDWriteGdiInterop1 *gdiinterop;
     IDWriteFontFallback *fallback;
 
     IDWriteLocalFontFileLoader* localfontfileloader;
@@ -1061,7 +1061,7 @@ static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory3 *iface, IDWrit
             return hr;
     }
 
-    *gdi_interop = This->gdiinterop;
+    *gdi_interop = (IDWriteGdiInterop*)This->gdiinterop;
     IDWriteGdiInterop_AddRef(*gdi_interop);
 
     return S_OK;
diff --git a/include/dwrite_3.idl b/include/dwrite_3.idl
index bf16800..85c20fe 100644
--- a/include/dwrite_3.idl
+++ b/include/dwrite_3.idl
@@ -24,6 +24,11 @@ interface IDWriteFontSet;
 interface IDWriteFontSetBuilder;
 interface IDWriteFontDownloadQueue;
 
+cpp_quote("#ifndef _WINGDI_")
+/* already defined in wingdi.h but needed for WIDL */
+typedef struct FONTSIGNATURE FONTSIGNATURE;
+cpp_quote("#endif /* _WINGDI_ */")
+
 typedef enum DWRITE_LOCALITY
 {
     DWRITE_LOCALITY_REMOTE,
@@ -257,6 +262,26 @@ interface IDWriteTextLayout3 : IDWriteTextLayout2
 [
     local,
     object,
+    uuid(4556be70-3abd-4f70-90be-421780a6f515)
+]
+interface IDWriteGdiInterop1 : IDWriteGdiInterop
+{
+    HRESULT CreateFontFromLOGFONT(LOGFONTW const *logfont,
+        IDWriteFontCollection *collection,
+        IDWriteFont **font);
+
+    /* GetFontSignature() methods are listed in reversed order to make
+       resulting vtable order compatible. */
+    HRESULT GetFontSignature_(IDWriteFontFace *fontface, FONTSIGNATURE *fontsig);
+    HRESULT GetFontSignature(IDWriteFont *font, FONTSIGNATURE *fontsig);
+    HRESULT GetMatchingFontsByLOGFONT(LOGFONTW const *logfont,
+        IDWriteFontSet *fontset,
+        IDWriteFontSet **subset);
+}
+
+[
+    local,
+    object,
     uuid(9a1b41c3-d3bb-466a-87fc-fe67556a3b65)
 ]
 interface IDWriteFactory3 : IDWriteFactory2
-- 
2.8.0.rc3




More information about the wine-patches mailing list