dwrite/layout: Use interface pointer in text format method traces.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-05-13 14:21:46 +03:00 committed by Alexandre Julliard
parent 93a852e262
commit 45361bb65e
1 changed files with 181 additions and 126 deletions

View File

@ -5242,9 +5242,7 @@ HRESULT create_trimmingsign(IDWriteFactory5 *factory, IDWriteTextFormat *format,
static HRESULT WINAPI dwritetextformat_QueryInterface(IDWriteTextFormat2 *iface, REFIID riid, void **obj)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
if (IsEqualIID(riid, &IID_IDWriteTextFormat2) ||
IsEqualIID(riid, &IID_IDWriteTextFormat1) ||
@ -5265,150 +5263,178 @@ static HRESULT WINAPI dwritetextformat_QueryInterface(IDWriteTextFormat2 *iface,
static ULONG WINAPI dwritetextformat_AddRef(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
return ref;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
ULONG refcount = InterlockedIncrement(&format->ref);
TRACE("%p, refcount %d.\n", iface, refcount);
return refcount;
}
static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
ULONG ref = InterlockedDecrement(&This->ref);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
ULONG refcount = InterlockedDecrement(&format->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %d.\n", iface, refcount);
if (!ref)
if (!refcount)
{
release_format_data(&This->format);
heap_free(This);
release_format_data(&format->format);
heap_free(format);
}
return ref;
return refcount;
}
static HRESULT WINAPI dwritetextformat_SetTextAlignment(IDWriteTextFormat2 *iface, DWRITE_TEXT_ALIGNMENT alignment)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%d)\n", This, alignment);
return format_set_textalignment(&This->format, alignment, NULL);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %d.\n", iface, alignment);
return format_set_textalignment(&format->format, alignment, NULL);
}
static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat2 *iface, DWRITE_PARAGRAPH_ALIGNMENT alignment)
static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat2 *iface,
DWRITE_PARAGRAPH_ALIGNMENT alignment)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%d)\n", This, alignment);
return format_set_paralignment(&This->format, alignment, NULL);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %d.\n", iface, alignment);
return format_set_paralignment(&format->format, alignment, NULL);
}
static HRESULT WINAPI dwritetextformat_SetWordWrapping(IDWriteTextFormat2 *iface, DWRITE_WORD_WRAPPING wrapping)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%d)\n", This, wrapping);
return format_set_wordwrapping(&This->format, wrapping, NULL);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %d.\n", iface, wrapping);
return format_set_wordwrapping(&format->format, wrapping, NULL);
}
static HRESULT WINAPI dwritetextformat_SetReadingDirection(IDWriteTextFormat2 *iface, DWRITE_READING_DIRECTION direction)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%d)\n", This, direction);
return format_set_readingdirection(&This->format, direction, NULL);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %d.\n", iface, direction);
return format_set_readingdirection(&format->format, direction, NULL);
}
static HRESULT WINAPI dwritetextformat_SetFlowDirection(IDWriteTextFormat2 *iface, DWRITE_FLOW_DIRECTION direction)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%d)\n", This, direction);
return format_set_flowdirection(&This->format, direction, NULL);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %d.\n", iface, direction);
return format_set_flowdirection(&format->format, direction, NULL);
}
static HRESULT WINAPI dwritetextformat_SetIncrementalTabStop(IDWriteTextFormat2 *iface, FLOAT tabstop)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%f)\n", This, tabstop);
TRACE("%p, %f.\n", iface, tabstop);
if (tabstop <= 0.0f)
return E_INVALIDARG;
This->format.tabstop = tabstop;
format->format.tabstop = tabstop;
return S_OK;
}
static HRESULT WINAPI dwritetextformat_SetTrimming(IDWriteTextFormat2 *iface, DWRITE_TRIMMING const *trimming,
IDWriteInlineObject *trimming_sign)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p %p)\n", This, trimming, trimming_sign);
return format_set_trimming(&This->format, trimming, trimming_sign, NULL);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %p, %p.\n", iface, trimming, trimming_sign);
return format_set_trimming(&format->format, trimming, trimming_sign, NULL);
}
static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat2 *iface, DWRITE_LINE_SPACING_METHOD method,
FLOAT height, FLOAT baseline)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
DWRITE_LINE_SPACING spacing;
TRACE("(%p)->(%d %f %f)\n", This, method, height, baseline);
TRACE("%p, %d, %f, %f.\n", iface, method, height, baseline);
spacing = This->format.spacing;
spacing = format->format.spacing;
spacing.method = method;
spacing.height = height;
spacing.baseline = baseline;
return format_set_linespacing(&This->format, &spacing, NULL);
return format_set_linespacing(&format->format, &spacing, NULL);
}
static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextformat_GetTextAlignment(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.textalignment;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.textalignment;
}
static DWRITE_PARAGRAPH_ALIGNMENT WINAPI dwritetextformat_GetParagraphAlignment(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.paralign;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.paralign;
}
static DWRITE_WORD_WRAPPING WINAPI dwritetextformat_GetWordWrapping(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.wrapping;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.wrapping;
}
static DWRITE_READING_DIRECTION WINAPI dwritetextformat_GetReadingDirection(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.readingdir;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.readingdir;
}
static DWRITE_FLOW_DIRECTION WINAPI dwritetextformat_GetFlowDirection(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.flow;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.flow;
}
static FLOAT WINAPI dwritetextformat_GetIncrementalTabStop(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.tabstop;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.tabstop;
}
static HRESULT WINAPI dwritetextformat_GetTrimming(IDWriteTextFormat2 *iface, DWRITE_TRIMMING *options,
IDWriteInlineObject **trimming_sign)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p %p)\n", This, options, trimming_sign);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
*options = This->format.trimming;
if ((*trimming_sign = This->format.trimmingsign))
TRACE("%p, %p, %p.\n", iface, options, trimming_sign);
*options = format->format.trimming;
if ((*trimming_sign = format->format.trimmingsign))
IDWriteInlineObject_AddRef(*trimming_sign);
return S_OK;
@ -5417,22 +5443,23 @@ static HRESULT WINAPI dwritetextformat_GetTrimming(IDWriteTextFormat2 *iface, DW
static HRESULT WINAPI dwritetextformat_GetLineSpacing(IDWriteTextFormat2 *iface, DWRITE_LINE_SPACING_METHOD *method,
FLOAT *spacing, FLOAT *baseline)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p %p %p)\n", This, method, spacing, baseline);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
*method = This->format.spacing.method;
*spacing = This->format.spacing.height;
*baseline = This->format.spacing.baseline;
TRACE("%p, %p, %p, %p.\n", iface, method, spacing, baseline);
*method = format->format.spacing.method;
*spacing = format->format.spacing.height;
*baseline = format->format.spacing.baseline;
return S_OK;
}
static HRESULT WINAPI dwritetextformat_GetFontCollection(IDWriteTextFormat2 *iface, IDWriteFontCollection **collection)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p)\n", This, collection);
TRACE("%p, %p.\n", iface, collection);
*collection = This->format.collection;
*collection = format->format.collection;
IDWriteFontCollection_AddRef(*collection);
return S_OK;
@ -5440,147 +5467,175 @@ static HRESULT WINAPI dwritetextformat_GetFontCollection(IDWriteTextFormat2 *ifa
static UINT32 WINAPI dwritetextformat_GetFontFamilyNameLength(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.family_len;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.family_len;
}
static HRESULT WINAPI dwritetextformat_GetFontFamilyName(IDWriteTextFormat2 *iface, WCHAR *name, UINT32 size)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p %u)\n", This, name, size);
TRACE("%p, %p, %u.\n", iface, name, size);
if (size <= This->format.family_len) return E_NOT_SUFFICIENT_BUFFER;
strcpyW(name, This->format.family_name);
if (size <= format->format.family_len)
return E_NOT_SUFFICIENT_BUFFER;
strcpyW(name, format->format.family_name);
return S_OK;
}
static DWRITE_FONT_WEIGHT WINAPI dwritetextformat_GetFontWeight(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.weight;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.weight;
}
static DWRITE_FONT_STYLE WINAPI dwritetextformat_GetFontStyle(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.style;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.style;
}
static DWRITE_FONT_STRETCH WINAPI dwritetextformat_GetFontStretch(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.stretch;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.stretch;
}
static FLOAT WINAPI dwritetextformat_GetFontSize(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.fontsize;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.fontsize;
}
static UINT32 WINAPI dwritetextformat_GetLocaleNameLength(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.locale_len;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.locale_len;
}
static HRESULT WINAPI dwritetextformat_GetLocaleName(IDWriteTextFormat2 *iface, WCHAR *name, UINT32 size)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p %u)\n", This, name, size);
TRACE("%p, %p %u.\n", iface, name, size);
if (size <= This->format.locale_len) return E_NOT_SUFFICIENT_BUFFER;
strcpyW(name, This->format.locale);
if (size <= format->format.locale_len)
return E_NOT_SUFFICIENT_BUFFER;
strcpyW(name, format->format.locale);
return S_OK;
}
static HRESULT WINAPI dwritetextformat1_SetVerticalGlyphOrientation(IDWriteTextFormat2 *iface, DWRITE_VERTICAL_GLYPH_ORIENTATION orientation)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%d)\n", This, orientation);
TRACE("%p, %d.\n", iface, orientation);
if ((UINT32)orientation > DWRITE_VERTICAL_GLYPH_ORIENTATION_STACKED)
return E_INVALIDARG;
This->format.vertical_orientation = orientation;
format->format.vertical_orientation = orientation;
return S_OK;
}
static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextformat1_GetVerticalGlyphOrientation(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.vertical_orientation;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.vertical_orientation;
}
static HRESULT WINAPI dwritetextformat1_SetLastLineWrapping(IDWriteTextFormat2 *iface, BOOL lastline_wrapping_enabled)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%d)\n", This, lastline_wrapping_enabled);
TRACE("%p, %d.\n", iface, lastline_wrapping_enabled);
This->format.last_line_wrapping = !!lastline_wrapping_enabled;
format->format.last_line_wrapping = !!lastline_wrapping_enabled;
return S_OK;
}
static BOOL WINAPI dwritetextformat1_GetLastLineWrapping(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.last_line_wrapping;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.last_line_wrapping;
}
static HRESULT WINAPI dwritetextformat1_SetOpticalAlignment(IDWriteTextFormat2 *iface, DWRITE_OPTICAL_ALIGNMENT alignment)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%d)\n", This, alignment);
return format_set_optical_alignment(&This->format, alignment);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %d.\n", iface, alignment);
return format_set_optical_alignment(&format->format, alignment);
}
static DWRITE_OPTICAL_ALIGNMENT WINAPI dwritetextformat1_GetOpticalAlignment(IDWriteTextFormat2 *iface)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)\n", This);
return This->format.optical_alignment;
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p.\n", iface);
return format->format.optical_alignment;
}
static HRESULT WINAPI dwritetextformat1_SetFontFallback(IDWriteTextFormat2 *iface, IDWriteFontFallback *fallback)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p)\n", This, fallback);
return set_fontfallback_for_format(&This->format, fallback);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %p.\n", iface, fallback);
return set_fontfallback_for_format(&format->format, fallback);
}
static HRESULT WINAPI dwritetextformat1_GetFontFallback(IDWriteTextFormat2 *iface, IDWriteFontFallback **fallback)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p)\n", This, fallback);
return get_fontfallback_from_format(&This->format, fallback);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %p.\n", iface, fallback);
return get_fontfallback_from_format(&format->format, fallback);
}
static HRESULT WINAPI dwritetextformat2_SetLineSpacing(IDWriteTextFormat2 *iface, DWRITE_LINE_SPACING const *spacing)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p)\n", This, spacing);
return format_set_linespacing(&This->format, spacing, NULL);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("%p, %p.\n", iface, spacing);
return format_set_linespacing(&format->format, spacing, NULL);
}
static HRESULT WINAPI dwritetextformat2_GetLineSpacing(IDWriteTextFormat2 *iface, DWRITE_LINE_SPACING *spacing)
{
struct dwrite_textformat *This = impl_from_IDWriteTextFormat2(iface);
struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface);
TRACE("(%p)->(%p)\n", This, spacing);
TRACE("%p, %p.\n", iface, spacing);
*spacing = This->format.spacing;
*spacing = format->format.spacing;
return S_OK;
}