dwrite: Use given ppdip factor in GetAlphaTextureBounds().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2015-10-16 13:21:53 +03:00 committed by Alexandre Julliard
parent 8b9e56cc9e
commit a23b395e87
2 changed files with 38 additions and 1 deletions

View File

@ -1097,7 +1097,12 @@ static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory2 *ifac
TRACE("(%p)->(%p %.2f %p %d %d %.2f %.2f %p)\n", This, run, ppdip, transform, rendering_mode, TRACE("(%p)->(%p %.2f %p %d %d %.2f %.2f %p)\n", This, run, ppdip, transform, rendering_mode,
measuring_mode, originX, originY, analysis); measuring_mode, originX, originY, analysis);
return create_glyphrunanalysis(rendering_mode, measuring_mode, run, 1.0f, DWRITE_GRID_FIT_MODE_DEFAULT, if (ppdip <= 0.0f) {
*analysis = NULL;
return E_INVALIDARG;
}
return create_glyphrunanalysis(rendering_mode, measuring_mode, run, ppdip, DWRITE_GRID_FIT_MODE_DEFAULT,
DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE, originX, originY, analysis); DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE, originX, originY, analysis);
} }

View File

@ -3531,17 +3531,37 @@ static void test_CreateGlyphRunAnalysis(void)
run.isSideways = FALSE; run.isSideways = FALSE;
run.bidiLevel = 0; run.bidiLevel = 0;
/* zero ppdip */
analysis = (void*)0xdeadbeef;
hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 0.0, NULL,
DWRITE_RENDERING_MODE_ALIASED, DWRITE_MEASURING_MODE_NATURAL,
0.0, 0.0, &analysis);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(analysis == NULL, "got %p\n", analysis);
/* negative ppdip */
analysis = (void*)0xdeadbeef;
hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, -1.0, NULL,
DWRITE_RENDERING_MODE_ALIASED, DWRITE_MEASURING_MODE_NATURAL,
0.0, 0.0, &analysis);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(analysis == NULL, "got %p\n", analysis);
/* default mode is not allowed */ /* default mode is not allowed */
analysis = (void*)0xdeadbeef;
hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL, hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL,
DWRITE_RENDERING_MODE_DEFAULT, DWRITE_MEASURING_MODE_NATURAL, DWRITE_RENDERING_MODE_DEFAULT, DWRITE_MEASURING_MODE_NATURAL,
0.0, 0.0, &analysis); 0.0, 0.0, &analysis);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(analysis == NULL, "got %p\n", analysis);
/* outline too */ /* outline too */
analysis = (void*)0xdeadbeef;
hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL, hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL,
DWRITE_RENDERING_MODE_OUTLINE, DWRITE_MEASURING_MODE_NATURAL, DWRITE_RENDERING_MODE_OUTLINE, DWRITE_MEASURING_MODE_NATURAL,
0.0, 0.0, &analysis); 0.0, 0.0, &analysis);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(analysis == NULL, "got %p\n", analysis);
hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL, hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL,
DWRITE_RENDERING_MODE_ALIASED, DWRITE_MEASURING_MODE_NATURAL, DWRITE_RENDERING_MODE_ALIASED, DWRITE_MEASURING_MODE_NATURAL,
@ -3562,6 +3582,18 @@ static void test_CreateGlyphRunAnalysis(void)
ok(!IsRectEmpty(&rect), "got empty rect\n"); ok(!IsRectEmpty(&rect), "got empty rect\n");
IDWriteGlyphRunAnalysis_Release(analysis); IDWriteGlyphRunAnalysis_Release(analysis);
/* doubled ppdip */
hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 2.0, NULL,
DWRITE_RENDERING_MODE_ALIASED, DWRITE_MEASURING_MODE_NATURAL,
0.0, 0.0, &analysis);
ok(hr == S_OK, "got 0x%08x\n", hr);
memset(&rect2, 0, sizeof(rect2));
hr = IDWriteGlyphRunAnalysis_GetAlphaTextureBounds(analysis, DWRITE_TEXTURE_ALIASED_1x1, &rect2);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(rect.right - rect.left < rect2.right - rect2.left, "expected wider rect\n");
ok(rect.bottom - rect.top < rect2.bottom - rect2.top, "expected taller rect\n");
IDWriteGlyphRunAnalysis_Release(analysis);
hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL, hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL,
DWRITE_RENDERING_MODE_ALIASED, DWRITE_MEASURING_MODE_NATURAL, DWRITE_RENDERING_MODE_ALIASED, DWRITE_MEASURING_MODE_NATURAL,
10.0, -5.0, &analysis); 10.0, -5.0, &analysis);