d2d1: Support underlined text in DrawTextLayout().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-01-21 22:29:51 +03:00 committed by Alexandre Julliard
parent f80a3f6c25
commit 4366407245
1 changed files with 17 additions and 2 deletions

View File

@ -1661,10 +1661,25 @@ static HRESULT STDMETHODCALLTYPE d2d_text_renderer_DrawGlyphRun(IDWriteTextRende
static HRESULT STDMETHODCALLTYPE d2d_text_renderer_DrawUnderline(IDWriteTextRenderer *iface, void *ctx,
float baseline_origin_x, float baseline_origin_y, const DWRITE_UNDERLINE *underline, IUnknown *effect)
{
FIXME("iface %p, ctx %p, baseline_origin_x %.8e, baseline_origin_y %.8e, underline %p, effect %p stub!\n",
struct d2d_d3d_render_target *render_target = impl_from_IDWriteTextRenderer(iface);
const D2D1_MATRIX_3X2_F *m = &render_target->drawing_state.transform;
struct d2d_draw_text_layout_ctx *context = ctx;
float min_thickness;
D2D1_RECT_F rect;
TRACE("iface %p, ctx %p, baseline_origin_x %.8e, baseline_origin_y %.8e, underline %p, effect %p\n",
iface, ctx, baseline_origin_x, baseline_origin_y, underline, effect);
return E_NOTIMPL;
/* minimal thickness in DIPs that will result in at least 1 pixel thick line */
min_thickness = 96.0f / (render_target->dpi_y * sqrtf(m->_21 * m->_21 + m->_22 * m->_22));
rect.left = baseline_origin_x;
rect.top = baseline_origin_y + underline->offset;
rect.right = baseline_origin_x + underline->width;
rect.bottom = baseline_origin_y + underline->offset + max(underline->thickness, min_thickness);
ID2D1RenderTarget_FillRectangle(&render_target->ID2D1RenderTarget_iface, &rect, context->brush);
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d2d_text_renderer_DrawStrikethrough(IDWriteTextRenderer *iface, void *ctx,