dwrite/font: Use consistent traces for the font object.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-12-01 15:14:59 +03:00 committed by Alexandre Julliard
parent 4130bbf48f
commit 5f219eccd5
1 changed files with 68 additions and 53 deletions

View File

@ -151,9 +151,10 @@ struct dwrite_fontlist
struct dwrite_fontfamily *family; struct dwrite_fontfamily *family;
}; };
struct dwrite_font { struct dwrite_font
{
IDWriteFont3 IDWriteFont3_iface; IDWriteFont3 IDWriteFont3_iface;
LONG ref; LONG refcount;
DWRITE_FONT_STYLE style; DWRITE_FONT_STYLE style;
struct dwrite_font_data *data; struct dwrite_font_data *data;
@ -1848,9 +1849,7 @@ static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace5
static HRESULT WINAPI dwritefont_QueryInterface(IDWriteFont3 *iface, REFIID riid, void **obj) static HRESULT WINAPI dwritefont_QueryInterface(IDWriteFont3 *iface, REFIID riid, void **obj)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
if (IsEqualIID(riid, &IID_IDWriteFont3) || if (IsEqualIID(riid, &IID_IDWriteFont3) ||
IsEqualIID(riid, &IID_IDWriteFont2) || IsEqualIID(riid, &IID_IDWriteFont2) ||
@ -1871,57 +1870,67 @@ static HRESULT WINAPI dwritefont_QueryInterface(IDWriteFont3 *iface, REFIID riid
static ULONG WINAPI dwritefont_AddRef(IDWriteFont3 *iface) static ULONG WINAPI dwritefont_AddRef(IDWriteFont3 *iface)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG refcount = InterlockedIncrement(&font->refcount);
TRACE("(%p)->(%d)\n", This, ref);
return ref; TRACE("%p, refcount %d.\n", iface, refcount);
return refcount;
} }
static ULONG WINAPI dwritefont_Release(IDWriteFont3 *iface) static ULONG WINAPI dwritefont_Release(IDWriteFont3 *iface)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG refcount = InterlockedDecrement(&font->refcount);
TRACE("(%p)->(%d)\n", This, ref); TRACE("%p, refcount %d.\n", iface, refcount);
if (!ref) { if (!refcount)
IDWriteFontFamily2_Release(&This->family->IDWriteFontFamily2_iface); {
release_font_data(This->data); IDWriteFontFamily2_Release(&font->family->IDWriteFontFamily2_iface);
heap_free(This); release_font_data(font->data);
heap_free(font);
} }
return ref; return refcount;
} }
static HRESULT WINAPI dwritefont_GetFontFamily(IDWriteFont3 *iface, IDWriteFontFamily **family) static HRESULT WINAPI dwritefont_GetFontFamily(IDWriteFont3 *iface, IDWriteFontFamily **family)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
TRACE("(%p)->(%p)\n", This, family);
*family = (IDWriteFontFamily*)This->family; TRACE("%p, %p.\n", iface, family);
*family = (IDWriteFontFamily *)font->family;
IDWriteFontFamily_AddRef(*family); IDWriteFontFamily_AddRef(*family);
return S_OK; return S_OK;
} }
static DWRITE_FONT_WEIGHT WINAPI dwritefont_GetWeight(IDWriteFont3 *iface) static DWRITE_FONT_WEIGHT WINAPI dwritefont_GetWeight(IDWriteFont3 *iface)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
TRACE("(%p)\n", This);
return This->data->weight; TRACE("%p.\n", iface);
return font->data->weight;
} }
static DWRITE_FONT_STRETCH WINAPI dwritefont_GetStretch(IDWriteFont3 *iface) static DWRITE_FONT_STRETCH WINAPI dwritefont_GetStretch(IDWriteFont3 *iface)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
TRACE("(%p)\n", This);
return This->data->stretch; TRACE("%p.\n", iface);
return font->data->stretch;
} }
static DWRITE_FONT_STYLE WINAPI dwritefont_GetStyle(IDWriteFont3 *iface) static DWRITE_FONT_STYLE WINAPI dwritefont_GetStyle(IDWriteFont3 *iface)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
TRACE("(%p)\n", This);
return This->style; TRACE("%p.\n", iface);
return font->style;
} }
static BOOL WINAPI dwritefont_IsSymbolFont(IDWriteFont3 *iface) static BOOL WINAPI dwritefont_IsSymbolFont(IDWriteFont3 *iface)
@ -1960,17 +1969,20 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont3 *iface,
static DWRITE_FONT_SIMULATIONS WINAPI dwritefont_GetSimulations(IDWriteFont3 *iface) static DWRITE_FONT_SIMULATIONS WINAPI dwritefont_GetSimulations(IDWriteFont3 *iface)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
TRACE("(%p)\n", This);
return This->data->simulations; TRACE("%p.\n", iface);
return font->data->simulations;
} }
static void WINAPI dwritefont_GetMetrics(IDWriteFont3 *iface, DWRITE_FONT_METRICS *metrics) static void WINAPI dwritefont_GetMetrics(IDWriteFont3 *iface, DWRITE_FONT_METRICS *metrics)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
TRACE("(%p)->(%p)\n", This, metrics); TRACE("%p, %p.\n", iface, metrics);
memcpy(metrics, &This->data->metrics, sizeof(*metrics));
memcpy(metrics, &font->data->metrics, sizeof(*metrics));
} }
static BOOL dwritefont_has_character(struct dwrite_font *font, UINT32 ch) static BOOL dwritefont_has_character(struct dwrite_font *font, UINT32 ch)
@ -2003,16 +2015,20 @@ static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont3 *iface, IDWriteFont
static void WINAPI dwritefont1_GetMetrics(IDWriteFont3 *iface, DWRITE_FONT_METRICS1 *metrics) static void WINAPI dwritefont1_GetMetrics(IDWriteFont3 *iface, DWRITE_FONT_METRICS1 *metrics)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
TRACE("(%p)->(%p)\n", This, metrics);
*metrics = This->data->metrics; TRACE("%p, %p.\n", iface, metrics);
*metrics = font->data->metrics;
} }
static void WINAPI dwritefont1_GetPanose(IDWriteFont3 *iface, DWRITE_PANOSE *panose) static void WINAPI dwritefont1_GetPanose(IDWriteFont3 *iface, DWRITE_PANOSE *panose)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); struct dwrite_font *font = impl_from_IDWriteFont3(iface);
TRACE("(%p)->(%p)\n", This, panose);
*panose = This->data->panose; TRACE("%p, %p.\n", iface, panose);
*panose = font->data->panose;
} }
static HRESULT WINAPI dwritefont1_GetUnicodeRanges(IDWriteFont3 *iface, UINT32 max_count, DWRITE_UNICODE_RANGE *ranges, static HRESULT WINAPI dwritefont1_GetUnicodeRanges(IDWriteFont3 *iface, UINT32 max_count, DWRITE_UNICODE_RANGE *ranges,
@ -2093,8 +2109,8 @@ static BOOL WINAPI dwritefont3_HasCharacter(IDWriteFont3 *iface, UINT32 ch)
static DWRITE_LOCALITY WINAPI dwritefont3_GetLocality(IDWriteFont3 *iface) static DWRITE_LOCALITY WINAPI dwritefont3_GetLocality(IDWriteFont3 *iface)
{ {
struct dwrite_font *This = impl_from_IDWriteFont3(iface); FIXME("%p: stub.\n", iface);
FIXME("(%p): stub\n", This);
return DWRITE_LOCALITY_LOCAL; return DWRITE_LOCALITY_LOCAL;
} }
@ -2179,23 +2195,22 @@ HRESULT get_fontsig_from_fontface(IDWriteFontFace *iface, FONTSIGNATURE *fontsig
static HRESULT create_font(struct dwrite_fontfamily *family, UINT32 index, IDWriteFont3 **font) static HRESULT create_font(struct dwrite_fontfamily *family, UINT32 index, IDWriteFont3 **font)
{ {
struct dwrite_font *This; struct dwrite_font *object;
*font = NULL; *font = NULL;
This = heap_alloc(sizeof(*This)); if (!(object = heap_alloc(sizeof(*object))))
if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IDWriteFont3_iface.lpVtbl = &dwritefontvtbl; object->IDWriteFont3_iface.lpVtbl = &dwritefontvtbl;
This->ref = 1; object->refcount = 1;
This->family = family; object->family = family;
IDWriteFontFamily2_AddRef(&family->IDWriteFontFamily2_iface); IDWriteFontFamily2_AddRef(&family->IDWriteFontFamily2_iface);
This->data = family->data->fonts[index]; object->data = family->data->fonts[index];
This->style = This->data->style; object->style = object->data->style;
addref_font_data(This->data); addref_font_data(object->data);
*font = &This->IDWriteFont3_iface; *font = &object->IDWriteFont3_iface;
return S_OK; return S_OK;
} }