dwrite: Make IDWriteGdiInterop1 a part of a factory.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
41729840e4
commit
dcfd21cfb2
|
@ -111,6 +111,12 @@ static inline FLOAT get_scaled_advance_width(INT32 advance, FLOAT emSize, const
|
||||||
return (FLOAT)advance * emSize / (FLOAT)metrics->designUnitsPerEm;
|
return (FLOAT)advance * emSize / (FLOAT)metrics->designUnitsPerEm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct gdiinterop
|
||||||
|
{
|
||||||
|
IDWriteGdiInterop1 IDWriteGdiInterop1_iface;
|
||||||
|
IDWriteFactory3 *factory;
|
||||||
|
};
|
||||||
|
|
||||||
struct textlayout_desc
|
struct textlayout_desc
|
||||||
{
|
{
|
||||||
IDWriteFactory3 *factory;
|
IDWriteFactory3 *factory;
|
||||||
|
@ -146,8 +152,7 @@ extern HRESULT create_textformat(const WCHAR*,IDWriteFontCollection*,DWRITE_FONT
|
||||||
extern HRESULT create_textlayout(const struct textlayout_desc*,IDWriteTextLayout**) DECLSPEC_HIDDEN;
|
extern HRESULT create_textlayout(const struct textlayout_desc*,IDWriteTextLayout**) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT create_trimmingsign(IDWriteFactory3*,IDWriteTextFormat*,IDWriteInlineObject**) DECLSPEC_HIDDEN;
|
extern HRESULT create_trimmingsign(IDWriteFactory3*,IDWriteTextFormat*,IDWriteInlineObject**) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT create_typography(IDWriteTypography**) DECLSPEC_HIDDEN;
|
extern HRESULT create_typography(IDWriteTypography**) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT create_gdiinterop(IDWriteFactory3*,IDWriteGdiInterop1**) DECLSPEC_HIDDEN;
|
extern void gdiinterop_init(struct gdiinterop*,IDWriteFactory3*) DECLSPEC_HIDDEN;
|
||||||
extern void release_gdiinterop(IDWriteGdiInterop1*) DECLSPEC_HIDDEN;
|
|
||||||
extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN;
|
extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
|
extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings) DECLSPEC_HIDDEN;
|
extern HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* GDI Interop
|
* GDI Interop
|
||||||
*
|
*
|
||||||
* Copyright 2011 Huw Davies
|
* Copyright 2011 Huw Davies
|
||||||
* Copyright 2012, 2014 Nikolay Sivov for CodeWeavers
|
* Copyright 2012, 2014-2016 Nikolay Sivov for CodeWeavers
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -32,11 +32,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
|
WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
|
||||||
|
|
||||||
struct gdiinterop {
|
|
||||||
IDWriteGdiInterop1 IDWriteGdiInterop1_iface;
|
|
||||||
IDWriteFactory3 *factory;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct dib_data {
|
struct dib_data {
|
||||||
DWORD *ptr;
|
DWORD *ptr;
|
||||||
int stride;
|
int stride;
|
||||||
|
@ -929,24 +924,10 @@ static const struct IDWriteGdiInterop1Vtbl gdiinteropvtbl = {
|
||||||
gdiinterop1_GetMatchingFontsByLOGFONT
|
gdiinterop1_GetMatchingFontsByLOGFONT
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT create_gdiinterop(IDWriteFactory3 *factory, IDWriteGdiInterop1 **ret)
|
void gdiinterop_init(struct gdiinterop *interop, IDWriteFactory3 *factory)
|
||||||
{
|
{
|
||||||
struct gdiinterop *This;
|
interop->IDWriteGdiInterop1_iface.lpVtbl = &gdiinteropvtbl;
|
||||||
|
/* Interop is a part of a factory, sharing its refcount.
|
||||||
*ret = NULL;
|
GetGdiInterop() will AddRef() on every call. */
|
||||||
|
interop->factory = factory;
|
||||||
This = heap_alloc(sizeof(struct gdiinterop));
|
|
||||||
if (!This) return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
This->IDWriteGdiInterop1_iface.lpVtbl = &gdiinteropvtbl;
|
|
||||||
This->factory = factory;
|
|
||||||
|
|
||||||
*ret= &This->IDWriteGdiInterop1_iface;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void release_gdiinterop(IDWriteGdiInterop1 *iface)
|
|
||||||
{
|
|
||||||
struct gdiinterop *interop = impl_from_IDWriteGdiInterop1(iface);
|
|
||||||
heap_free(interop);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,7 +525,7 @@ struct dwritefactory {
|
||||||
|
|
||||||
IDWriteFontCollection *system_collection;
|
IDWriteFontCollection *system_collection;
|
||||||
IDWriteFontCollection *eudc_collection;
|
IDWriteFontCollection *eudc_collection;
|
||||||
IDWriteGdiInterop1 *gdiinterop;
|
struct gdiinterop interop;
|
||||||
IDWriteFontFallback *fallback;
|
IDWriteFontFallback *fallback;
|
||||||
|
|
||||||
IDWriteLocalFontFileLoader* localfontfileloader;
|
IDWriteLocalFontFileLoader* localfontfileloader;
|
||||||
|
@ -586,8 +586,6 @@ static void release_dwritefactory(struct dwritefactory *factory)
|
||||||
IDWriteFontCollection_Release(factory->system_collection);
|
IDWriteFontCollection_Release(factory->system_collection);
|
||||||
if (factory->eudc_collection)
|
if (factory->eudc_collection)
|
||||||
IDWriteFontCollection_Release(factory->eudc_collection);
|
IDWriteFontCollection_Release(factory->eudc_collection);
|
||||||
if (factory->gdiinterop)
|
|
||||||
release_gdiinterop(factory->gdiinterop);
|
|
||||||
if (factory->fallback)
|
if (factory->fallback)
|
||||||
release_system_fontfallback(factory->fallback);
|
release_system_fontfallback(factory->fallback);
|
||||||
heap_free(factory);
|
heap_free(factory);
|
||||||
|
@ -1057,17 +1055,8 @@ static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory3 *iface, IDWrit
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, gdi_interop);
|
TRACE("(%p)->(%p)\n", This, gdi_interop);
|
||||||
|
|
||||||
*gdi_interop = NULL;
|
*gdi_interop = (IDWriteGdiInterop*)&This->interop.IDWriteGdiInterop1_iface;
|
||||||
|
|
||||||
if (!This->gdiinterop) {
|
|
||||||
HRESULT hr = create_gdiinterop(iface, &This->gdiinterop);
|
|
||||||
if (FAILED(hr))
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
*gdi_interop = (IDWriteGdiInterop*)This->gdiinterop;
|
|
||||||
IDWriteGdiInterop_AddRef(*gdi_interop);
|
IDWriteGdiInterop_AddRef(*gdi_interop);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1489,7 +1478,7 @@ static void init_dwritefactory(struct dwritefactory *factory, DWRITE_FACTORY_TYP
|
||||||
factory->localfontfileloader = NULL;
|
factory->localfontfileloader = NULL;
|
||||||
factory->system_collection = NULL;
|
factory->system_collection = NULL;
|
||||||
factory->eudc_collection = NULL;
|
factory->eudc_collection = NULL;
|
||||||
factory->gdiinterop = NULL;
|
gdiinterop_init(&factory->interop, &factory->IDWriteFactory3_iface);
|
||||||
factory->fallback = NULL;
|
factory->fallback = NULL;
|
||||||
|
|
||||||
list_init(&factory->collection_loaders);
|
list_init(&factory->collection_loaders);
|
||||||
|
|
Loading…
Reference in New Issue