Nikolay Sivov : dwrite: Added IDWriteColorGlyphRunEnumerator stub.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 7 10:57:42 CDT 2015


Module: wine
Branch: master
Commit: 93d24de308471d665d95b38b7b79ffb2125b4908
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=93d24de308471d665d95b38b7b79ffb2125b4908

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Aug  6 19:44:53 2015 +0300

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 48078d9..1b7bd3a 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 80a209f..1f4e565 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 9f8756d..01a4012 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,




More information about the wine-cvs mailing list