From 93d24de308471d665d95b38b7b79ffb2125b4908 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 6 Aug 2015 19:44:53 +0300 Subject: [PATCH] dwrite: Added IDWriteColorGlyphRunEnumerator stub. --- dlls/dwrite/dwrite_private.h | 2 + dlls/dwrite/font.c | 89 ++++++++++++++++++++++++++++++++++++ dlls/dwrite/main.c | 8 ++-- 3 files changed, 95 insertions(+), 4 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 48078d9ca81..1b7bd3a202a 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -136,6 +136,8 @@ extern HRESULT get_local_refkey(const WCHAR*,const FILETIME*,void**,UINT32*) DEC extern HRESULT get_filestream_from_file(IDWriteFontFile*,IDWriteFontFileStream**) DECLSPEC_HIDDEN; extern BOOL is_face_type_supported(DWRITE_FONT_FACE_TYPE) DECLSPEC_HIDDEN; extern HRESULT get_family_names_from_stream(IDWriteFontFileStream*,UINT32,DWRITE_FONT_FACE_TYPE,IDWriteLocalizedStrings**) DECLSPEC_HIDDEN; +extern HRESULT create_colorglyphenum(FLOAT,FLOAT,const DWRITE_GLYPH_RUN*,const DWRITE_GLYPH_RUN_DESCRIPTION*,DWRITE_MEASURING_MODE, + const DWRITE_MATRIX*,UINT32,IDWriteColorGlyphRunEnumerator**) DECLSPEC_HIDDEN; /* Opentype font table functions */ struct dwrite_font_props { diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 80a209ff873..1f4e5657447 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -131,6 +131,11 @@ struct dwrite_glyphrunanalysis { BYTE *bitmap; }; +struct dwrite_colorglyphenum { + IDWriteColorGlyphRunEnumerator IDWriteColorGlyphRunEnumerator_iface; + LONG ref; +}; + #define GLYPH_BLOCK_SHIFT 8 #define GLYPH_BLOCK_SIZE (1UL << GLYPH_BLOCK_SHIFT) #define GLYPH_BLOCK_MASK (GLYPH_BLOCK_SIZE - 1) @@ -199,6 +204,11 @@ static inline struct dwrite_glyphrunanalysis *impl_from_IDWriteGlyphRunAnalysis( return CONTAINING_RECORD(iface, struct dwrite_glyphrunanalysis, IDWriteGlyphRunAnalysis_iface); } +static inline struct dwrite_colorglyphenum *impl_from_IDWriteColorGlyphRunEnumerator(IDWriteColorGlyphRunEnumerator *iface) +{ + return CONTAINING_RECORD(iface, struct dwrite_colorglyphenum, IDWriteColorGlyphRunEnumerator_iface); +} + static inline const char *debugstr_tag(UINT32 tag) { return wine_dbg_sprintf("%c%c%c%c", tag >> 24, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff); @@ -3321,3 +3331,82 @@ HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEA *ret = &analysis->IDWriteGlyphRunAnalysis_iface; return S_OK; } + +/* IDWriteColorGlyphRunEnumerator */ +static HRESULT WINAPI colorglyphenum_QueryInterface(IDWriteColorGlyphRunEnumerator *iface, REFIID riid, void **ppv) +{ + struct dwrite_colorglyphenum *This = impl_from_IDWriteColorGlyphRunEnumerator(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + + if (IsEqualIID(riid, &IID_IDWriteColorGlyphRunEnumerator) || + IsEqualIID(riid, &IID_IUnknown)) + { + *ppv = iface; + IDWriteColorGlyphRunEnumerator_AddRef(iface); + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI colorglyphenum_AddRef(IDWriteColorGlyphRunEnumerator *iface) +{ + struct dwrite_colorglyphenum *This = impl_from_IDWriteColorGlyphRunEnumerator(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%u)\n", This, ref); + return ref; +} + +static ULONG WINAPI colorglyphenum_Release(IDWriteColorGlyphRunEnumerator *iface) +{ + struct dwrite_colorglyphenum *This = impl_from_IDWriteColorGlyphRunEnumerator(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%u)\n", This, ref); + + if (!ref) + heap_free(This); + + return ref; +} + +static HRESULT WINAPI colorglyphenum_MoveNext(IDWriteColorGlyphRunEnumerator *iface, BOOL *has_run) +{ + struct dwrite_colorglyphenum *This = impl_from_IDWriteColorGlyphRunEnumerator(iface); + FIXME("(%p)->(%p): stub\n", This, has_run); + return E_NOTIMPL; +} + +static HRESULT WINAPI colorglyphenum_GetCurrentRun(IDWriteColorGlyphRunEnumerator *iface, DWRITE_COLOR_GLYPH_RUN const **run) +{ + struct dwrite_colorglyphenum *This = impl_from_IDWriteColorGlyphRunEnumerator(iface); + FIXME("(%p)->(%p): stub\n", This, run); + return E_NOTIMPL; +} + +static const IDWriteColorGlyphRunEnumeratorVtbl colorglyphenumvtbl = { + colorglyphenum_QueryInterface, + colorglyphenum_AddRef, + colorglyphenum_Release, + colorglyphenum_MoveNext, + colorglyphenum_GetCurrentRun +}; + +HRESULT create_colorglyphenum(FLOAT originX, FLOAT originY, const DWRITE_GLYPH_RUN *run, const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, + DWRITE_MEASURING_MODE mode, const DWRITE_MATRIX *transform, UINT32 palette, IDWriteColorGlyphRunEnumerator **ret) +{ + struct dwrite_colorglyphenum *colorglyphenum; + + *ret = NULL; + colorglyphenum = heap_alloc(sizeof(*colorglyphenum)); + if (!colorglyphenum) + return E_OUTOFMEMORY; + + colorglyphenum->IDWriteColorGlyphRunEnumerator_iface.lpVtbl = &colorglyphenumvtbl; + colorglyphenum->ref = 1; + + *ret = &colorglyphenum->IDWriteColorGlyphRunEnumerator_iface; + return S_OK; +} diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 9f8756dadf5..01a401226e6 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -1137,12 +1137,12 @@ static HRESULT WINAPI dwritefactory2_CreateFontFallbackBuilder(IDWriteFactory2 * static HRESULT WINAPI dwritefactory2_TranslateColorGlyphRun(IDWriteFactory2 *iface, FLOAT originX, FLOAT originY, const DWRITE_GLYPH_RUN *run, const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, DWRITE_MEASURING_MODE mode, - const DWRITE_MATRIX *transform, UINT32 palette_index, IDWriteColorGlyphRunEnumerator **colorlayers) + const DWRITE_MATRIX *transform, UINT32 palette, IDWriteColorGlyphRunEnumerator **colorlayers) { struct dwritefactory *This = impl_from_IDWriteFactory2(iface); - FIXME("(%p)->(%.2f %.2f %p %p %d %p %u %p): stub\n", This, originX, originY, run, rundescr, mode, - transform, palette_index, colorlayers); - return E_NOTIMPL; + TRACE("(%p)->(%.2f %.2f %p %p %d %p %u %p)\n", This, originX, originY, run, rundescr, mode, + transform, palette, colorlayers); + return create_colorglyphenum(originX, originY, run, rundescr, mode, transform, palette, colorlayers); } static HRESULT WINAPI dwritefactory2_CreateCustomRenderingParams(IDWriteFactory2 *iface, FLOAT gamma, FLOAT contrast,