Nikolay Sivov : dwrite/layout: Remove unnecessary argument check from GetFontCollection().

Alexandre Julliard julliard at winehq.org
Fri Feb 19 17:20:09 CST 2021


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Feb 19 12:03:49 2021 +0300

dwrite/layout: Remove unnecessary argument check from GetFontCollection().

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

---

 dlls/dwrite/layout.c       |  3 ---
 dlls/dwrite/tests/layout.c | 10 +++++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index 482fcc733db..fc874541d74 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -3403,9 +3403,6 @@ static HRESULT WINAPI dwritetextlayout_layout_GetFontCollection(IDWriteTextLayou
 
     TRACE("%p, %u, %p, %p.\n", iface, position, collection, r);
 
-    if (position >= layout->len)
-        return S_OK;
-
     range = get_layout_range_by_pos(layout, position);
     *collection = range->collection;
     if (*collection)
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index b96ff2f0289..adc9503ffd9 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -5973,8 +5973,8 @@ if (SUCCEEDED(hr))
 
 static void test_layout_range_length(void)
 {
+    IDWriteFontCollection *collection, *collection2;
     IDWriteInlineObject *sign, *object;
-    IDWriteFontCollection *collection;
     IDWriteTypography *typography;
     DWRITE_FONT_STRETCH stretch;
     IDWriteTextLayout1 *layout1;
@@ -6305,6 +6305,14 @@ static void test_layout_range_length(void)
     hr = IDWriteTextLayout_SetFontCollection(layout, NULL, range);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
 
+    range.startPosition = range.length = 0;
+    collection2 = NULL;
+    hr = IDWriteTextLayout_GetFontCollection(layout, 10, &collection2, &range);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(range.length == ~0u, "Unexpected range length %u.\n", range.length);
+    if (collection2)
+        IDWriteFontCollection_Release(collection2);
+
     IDWriteFontCollection_Release(collection);
 
     if (SUCCEEDED(IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextLayout1, (void **)&layout1)))




More information about the wine-cvs mailing list