Nikolay Sivov : dwrite: Use newer analyzer interface internally.

Alexandre Julliard julliard at winehq.org
Mon Feb 22 15:43:22 CST 2021


Module: wine
Branch: master
Commit: f18acbfef3850c6ec7f568b28aea5be92c78916e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f18acbfef3850c6ec7f568b28aea5be92c78916e

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Feb 22 21:29:37 2021 +0300

dwrite: Use newer analyzer interface internally.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/analyzer.c       |  4 ++--
 dlls/dwrite/dwrite_private.h |  2 +-
 dlls/dwrite/layout.c         | 21 +++++++++++----------
 dlls/dwrite/main.c           |  2 +-
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index d0d769cb346..6b74a23540a 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -1844,9 +1844,9 @@ static const IDWriteTextAnalyzer2Vtbl textanalyzervtbl =
 
 static IDWriteTextAnalyzer2 textanalyzer = { &textanalyzervtbl };
 
-IDWriteTextAnalyzer *get_text_analyzer(void)
+IDWriteTextAnalyzer2 *get_text_analyzer(void)
 {
-    return (IDWriteTextAnalyzer *)&textanalyzer;
+    return &textanalyzer;
 }
 
 static HRESULT WINAPI dwritenumbersubstitution_QueryInterface(IDWriteNumberSubstitution *iface, REFIID riid, void **obj)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 13bef3ad36b..6528970635b 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -304,7 +304,7 @@ extern void    set_en_localizedstring(IDWriteLocalizedStrings*,const WCHAR*) DEC
 extern void    sort_localizedstrings(IDWriteLocalizedStrings*) DECLSPEC_HIDDEN;
 extern HRESULT get_system_fontcollection(IDWriteFactory7 *factory, IDWriteFontCollection1 **collection) DECLSPEC_HIDDEN;
 extern HRESULT get_eudc_fontcollection(IDWriteFactory7 *factory, IDWriteFontCollection3 **collection) DECLSPEC_HIDDEN;
-extern IDWriteTextAnalyzer *get_text_analyzer(void) DECLSPEC_HIDDEN;
+extern IDWriteTextAnalyzer2 *get_text_analyzer(void) DECLSPEC_HIDDEN;
 extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) DECLSPEC_HIDDEN;
 extern void    init_local_fontfile_loader(void) DECLSPEC_HIDDEN;
 extern IDWriteFontFileLoader *get_local_fontfile_loader(void) DECLSPEC_HIDDEN;
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index fc874541d74..3e5c0379609 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -790,7 +790,7 @@ static void layout_get_font_height(FLOAT emsize, DWRITE_FONT_METRICS *fontmetric
 
 static HRESULT layout_itemize(struct dwrite_textlayout *layout)
 {
-    IDWriteTextAnalyzer *analyzer;
+    IDWriteTextAnalyzer2 *analyzer;
     struct layout_range *range;
     struct layout_run *r;
     HRESULT hr = S_OK;
@@ -818,14 +818,14 @@ static HRESULT layout_itemize(struct dwrite_textlayout *layout)
         }
 
         /* Initial splitting by script. */
-        hr = IDWriteTextAnalyzer_AnalyzeScript(analyzer, (IDWriteTextAnalysisSource *)&layout->IDWriteTextAnalysisSource1_iface,
+        hr = IDWriteTextAnalyzer2_AnalyzeScript(analyzer, (IDWriteTextAnalysisSource *)&layout->IDWriteTextAnalysisSource1_iface,
                 range->h.range.startPosition, get_clipped_range_length(layout, range),
                 (IDWriteTextAnalysisSink *)&layout->IDWriteTextAnalysisSink1_iface);
         if (FAILED(hr))
             break;
 
         /* Splitting further by bidi levels. */
-        hr = IDWriteTextAnalyzer_AnalyzeBidi(analyzer, (IDWriteTextAnalysisSource *)&layout->IDWriteTextAnalysisSource1_iface,
+        hr = IDWriteTextAnalyzer2_AnalyzeBidi(analyzer, (IDWriteTextAnalysisSource *)&layout->IDWriteTextAnalysisSource1_iface,
                 range->h.range.startPosition, get_clipped_range_length(layout, range),
                 (IDWriteTextAnalysisSink *)&layout->IDWriteTextAnalysisSink1_iface);
         if (FAILED(hr))
@@ -962,7 +962,7 @@ fatal:
 
 struct shaping_context
 {
-    IDWriteTextAnalyzer *analyzer;
+    IDWriteTextAnalyzer2 *analyzer;
     struct regular_layout_run *run;
     DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props;
     DWRITE_SHAPING_TEXT_PROPERTIES *text_props;
@@ -1109,7 +1109,7 @@ static HRESULT layout_shape_get_glyphs(struct dwrite_textlayout *layout, struct
 
     for (;;)
     {
-        hr = IDWriteTextAnalyzer_GetGlyphs(context->analyzer, run->descr.string, run->descr.stringLength, run->run.fontFace,
+        hr = IDWriteTextAnalyzer2_GetGlyphs(context->analyzer, run->descr.string, run->descr.stringLength, run->run.fontFace,
                 run->run.isSideways, run->run.bidiLevel & 1, &run->sa, run->descr.localeName, NULL /* FIXME */,
                 (const DWRITE_TYPOGRAPHIC_FEATURES **)context->user_features.features, context->user_features.range_lengths,
                 context->user_features.range_count, max_count, run->clustermap, context->text_props, run->glyphs,
@@ -1156,14 +1156,14 @@ static HRESULT layout_shape_get_positions(struct dwrite_textlayout *layout, stru
 
     /* Get advances and offsets. */
     if (is_layout_gdi_compatible(layout))
-        hr = IDWriteTextAnalyzer_GetGdiCompatibleGlyphPlacements(context->analyzer, run->descr.string, run->descr.clusterMap,
+        hr = IDWriteTextAnalyzer2_GetGdiCompatibleGlyphPlacements(context->analyzer, run->descr.string, run->descr.clusterMap,
                 context->text_props, run->descr.stringLength, run->run.glyphIndices, context->glyph_props, run->glyphcount,
                 run->run.fontFace, run->run.fontEmSize, layout->ppdip, &layout->transform,
                 layout->measuringmode == DWRITE_MEASURING_MODE_GDI_NATURAL, run->run.isSideways, run->run.bidiLevel & 1,
                 &run->sa, run->descr.localeName, (const DWRITE_TYPOGRAPHIC_FEATURES **)context->user_features.features,
                 context->user_features.range_lengths, context->user_features.range_count, run->advances, run->offsets);
     else
-        hr = IDWriteTextAnalyzer_GetGlyphPlacements(context->analyzer, run->descr.string, run->descr.clusterMap,
+        hr = IDWriteTextAnalyzer2_GetGlyphPlacements(context->analyzer, run->descr.string, run->descr.clusterMap,
                 context->text_props, run->descr.stringLength, run->run.glyphIndices, context->glyph_props, run->glyphcount,
                 run->run.fontFace, run->run.fontEmSize, run->run.isSideways, run->run.bidiLevel & 1, &run->sa,
                 run->descr.localeName, (const DWRITE_TYPOGRAPHIC_FEATURES **)context->user_features.features,
@@ -1302,8 +1302,9 @@ static HRESULT layout_compute(struct dwrite_textlayout *layout)
         return S_OK;
 
     /* nominal breakpoints are evaluated only once, because string never changes */
-    if (!layout->nominal_breakpoints) {
-        IDWriteTextAnalyzer *analyzer;
+    if (!layout->nominal_breakpoints)
+    {
+        IDWriteTextAnalyzer2 *analyzer;
 
         layout->nominal_breakpoints = heap_calloc(layout->len, sizeof(*layout->nominal_breakpoints));
         if (!layout->nominal_breakpoints)
@@ -1311,7 +1312,7 @@ static HRESULT layout_compute(struct dwrite_textlayout *layout)
 
         analyzer = get_text_analyzer();
 
-        if (FAILED(hr = IDWriteTextAnalyzer_AnalyzeLineBreakpoints(analyzer,
+        if (FAILED(hr = IDWriteTextAnalyzer2_AnalyzeLineBreakpoints(analyzer,
                 (IDWriteTextAnalysisSource *)&layout->IDWriteTextAnalysisSource1_iface,
                 0, layout->len, (IDWriteTextAnalysisSink *)&layout->IDWriteTextAnalysisSink1_iface)))
             WARN("Line breakpoints analysis failed, hr %#x.\n", hr);
diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c
index 560661983d0..864a44936c1 100644
--- a/dlls/dwrite/main.c
+++ b/dlls/dwrite/main.c
@@ -1243,7 +1243,7 @@ static HRESULT WINAPI dwritefactory_CreateTextAnalyzer(IDWriteFactory7 *iface, I
 {
     TRACE("%p, %p.\n", iface, analyzer);
 
-    *analyzer = get_text_analyzer();
+    *analyzer = (IDWriteTextAnalyzer *)get_text_analyzer();
 
     return S_OK;
 }




More information about the wine-cvs mailing list