dwrite: Do not create intermediate object to return face reference from family.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-02-03 19:08:30 +03:00 committed by Alexandre Julliard
parent e091903999
commit 82df524e7e
1 changed files with 7 additions and 9 deletions

View File

@ -2429,21 +2429,19 @@ static HRESULT WINAPI dwritefontfamily1_GetFont(IDWriteFontFamily2 *iface, UINT3
static HRESULT WINAPI dwritefontfamily1_GetFontFaceReference(IDWriteFontFamily2 *iface, UINT32 index,
IDWriteFontFaceReference **reference)
{
IDWriteFont3 *font;
HRESULT hr;
struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface);
const struct dwrite_font_data *font;
TRACE("%p, %u, %p.\n", iface, index, reference);
*reference = NULL;
hr = IDWriteFontFamily2_GetFont(iface, index, &font);
if (FAILED(hr))
return hr;
if (index >= family->data->count)
return E_FAIL;
hr = IDWriteFont3_GetFontFaceReference(font, reference);
IDWriteFont3_Release(font);
return hr;
font = family->data->fonts[index];
return IDWriteFactory5_CreateFontFaceReference_((IDWriteFactory5 *)family->collection->factory,
font->file, font->face_index, font->simulations, reference);
}
static HRESULT WINAPI dwritefontfamily2_GetMatchingFonts(IDWriteFontFamily2 *iface,