On Wed Sep 3 11:45:18 2014, Alexandre Julliard wrote:
Aric Stewart aric@codeweavers.com writes:
@@ -1121,6 +1188,24 @@ static void get_font_properties(struct dwrite_font *font, HDC hdc) } }
+static HRESULT create_font_from_data(struct dwrite_font_data *data, IDWriteFont **font) +{
- HRESULT hr;
- struct dwrite_font *This;
- hr = create_font_base(font);
- if (FAILED(hr))
return hr;
- This = impl_from_IDWriteFont(*font);
- heap_free(This->data);
- This->data = data;
- InterlockedIncrement(&This->data->ref);
- return S_OK;
+}
That looks unnecessarily complicated. Why allocate and initialize the data only to immediately replace it?
There ends up being 2 ways that a IDWriteFont is created, one via existing data (as shown here) where we do not need the data initialized and one via an external resource (Such as a logfont or IDWriteFontFace) where we will use the initialized data.
Would you prefer that I do not alloc/initialize the data in create_font and instead only alloc/initialize in the external resource case?
thanks! -aric