Nikolay Sivov : d2d1: Pass inline object effect through rendering context.

Alexandre Julliard julliard at winehq.org
Thu Aug 24 14:18:25 CDT 2017


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Aug 24 17:33:07 2017 +0300

d2d1: Pass inline object effect through rendering context.

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

---

 dlls/d2d1/render_target.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
index 2ac62e4..0428245 100644
--- a/dlls/d2d1/render_target.c
+++ b/dlls/d2d1/render_target.c
@@ -1982,10 +1982,26 @@ static HRESULT STDMETHODCALLTYPE d2d_text_renderer_DrawStrikethrough(IDWriteText
 static HRESULT STDMETHODCALLTYPE d2d_text_renderer_DrawInlineObject(IDWriteTextRenderer *iface, void *ctx,
         float origin_x, float origin_y, IDWriteInlineObject *object, BOOL is_sideways, BOOL is_rtl, IUnknown *effect)
 {
+    struct d2d_draw_text_layout_ctx *context = ctx;
+    ID2D1Brush *brush;
+    HRESULT hr;
+
     TRACE("iface %p, ctx %p, origin_x %.8e, origin_y %.8e, object %p, is_sideways %#x, is_rtl %#x, effect %p.\n",
             iface, ctx, origin_x, origin_y, object, is_sideways, is_rtl, effect);
 
-    return IDWriteInlineObject_Draw(object, ctx, iface, origin_x, origin_y, is_sideways, is_rtl, effect);
+    /* Inline objects may not pass effects all the way down, when using layout object internally for example.
+       This is how default trimming sign object in DirectWrite works - it does not use effect passed to Draw(),
+       and resulting DrawGlyphRun() is always called with NULL effect, however original effect is used and correct
+       brush is selected at Direct2D level. */
+    brush = context->brush;
+    context->brush = d2d_draw_get_text_brush(context, effect);
+
+    hr = IDWriteInlineObject_Draw(object, ctx, iface, origin_x, origin_y, is_sideways, is_rtl, effect);
+
+    ID2D1Brush_Release(context->brush);
+    context->brush = brush;
+
+    return hr;
 }
 
 static const struct IDWriteTextRendererVtbl d2d_text_renderer_vtbl =




More information about the wine-cvs mailing list