Commit 9521c6a1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d2d1: Pass zeros as text layout size for inverted rectangles in DrawText().

parent f37c8345
...@@ -1161,6 +1161,7 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawText(ID2D1DeviceContext *if ...@@ -1161,6 +1161,7 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawText(ID2D1DeviceContext *if
IDWriteTextLayout *text_layout; IDWriteTextLayout *text_layout;
IDWriteFactory *dwrite_factory; IDWriteFactory *dwrite_factory;
D2D1_POINT_2F origin; D2D1_POINT_2F origin;
float width, height;
HRESULT hr; HRESULT hr;
TRACE("iface %p, string %s, string_len %u, text_format %p, layout_rect %s, " TRACE("iface %p, string %s, string_len %u, text_format %p, layout_rect %s, "
...@@ -1175,13 +1176,15 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawText(ID2D1DeviceContext *if ...@@ -1175,13 +1176,15 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawText(ID2D1DeviceContext *if
return; return;
} }
width = max(0.0f, layout_rect->right - layout_rect->left);
height = max(0.0f, layout_rect->bottom - layout_rect->top);
if (measuring_mode == DWRITE_MEASURING_MODE_NATURAL) if (measuring_mode == DWRITE_MEASURING_MODE_NATURAL)
hr = IDWriteFactory_CreateTextLayout(dwrite_factory, string, string_len, text_format, hr = IDWriteFactory_CreateTextLayout(dwrite_factory, string, string_len, text_format,
layout_rect->right - layout_rect->left, layout_rect->bottom - layout_rect->top, &text_layout); width, height, &text_layout);
else else
hr = IDWriteFactory_CreateGdiCompatibleTextLayout(dwrite_factory, string, string_len, text_format, hr = IDWriteFactory_CreateGdiCompatibleTextLayout(dwrite_factory, string, string_len, text_format,
layout_rect->right - layout_rect->left, layout_rect->bottom - layout_rect->top, render_target->desc.dpiX / 96.0f, width, height, render_target->desc.dpiX / 96.0f, (DWRITE_MATRIX *)&render_target->drawing_state.transform,
(DWRITE_MATRIX*)&render_target->drawing_state.transform, measuring_mode == DWRITE_MEASURING_MODE_GDI_NATURAL, &text_layout); measuring_mode == DWRITE_MEASURING_MODE_GDI_NATURAL, &text_layout);
IDWriteFactory_Release(dwrite_factory); IDWriteFactory_Release(dwrite_factory);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment