dwrite: Don't create enumerator with invalid palette.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ec3c7d9d3a
commit
63e1b3f545
|
@ -4643,7 +4643,7 @@ HRESULT create_colorglyphenum(FLOAT originX, FLOAT originY, const DWRITE_GLYPH_R
|
|||
return hr;
|
||||
}
|
||||
|
||||
colorfont = IDWriteFontFace2_IsColorFont(fontface2);
|
||||
colorfont = IDWriteFontFace2_IsColorFont(fontface2) && IDWriteFontFace2_GetColorPaletteCount(fontface2) > palette;
|
||||
IDWriteFontFace2_Release(fontface2);
|
||||
if (!colorfont)
|
||||
return DWRITE_E_NOCOLOR;
|
||||
|
|
|
@ -5137,6 +5137,7 @@ static void test_TranslateColorGlyphRun(void)
|
|||
{
|
||||
IDWriteColorGlyphRunEnumerator *layers;
|
||||
const DWRITE_COLOR_GLYPH_RUN *colorrun;
|
||||
IDWriteFontFace2 *fontface2;
|
||||
IDWriteFontFace *fontface;
|
||||
IDWriteFactory2 *factory2;
|
||||
IDWriteFactory *factory;
|
||||
|
@ -5200,9 +5201,12 @@ static void test_TranslateColorGlyphRun(void)
|
|||
layers = NULL;
|
||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0, 0.0, &run, NULL,
|
||||
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
||||
todo_wine {
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(layers != NULL, "got %p\n", layers);
|
||||
}
|
||||
|
||||
if (layers) {
|
||||
while (1) {
|
||||
hasrun = FALSE;
|
||||
hr = IDWriteColorGlyphRunEnumerator_MoveNext(layers, &hasrun);
|
||||
|
@ -5219,6 +5223,26 @@ todo_wine
|
|||
ok(hr == E_NOT_VALID_STATE, "got 0x%08x\n", hr);
|
||||
|
||||
IDWriteColorGlyphRunEnumerator_Release(layers);
|
||||
}
|
||||
hr = IDWriteFontFace_QueryInterface(fontface, &IID_IDWriteFontFace2, (void**)&fontface2);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
/* invalid palette index */
|
||||
layers = (void*)0xdeadbeef;
|
||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0f, 0.0f, &run, NULL,
|
||||
DWRITE_MEASURING_MODE_NATURAL, NULL, IDWriteFontFace2_GetColorPaletteCount(fontface2),
|
||||
&layers);
|
||||
ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
|
||||
ok(layers == NULL, "got %p\n", layers);
|
||||
|
||||
layers = NULL;
|
||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0f, 0.0f, &run, NULL,
|
||||
DWRITE_MEASURING_MODE_NATURAL, NULL, IDWriteFontFace2_GetColorPaletteCount(fontface2) - 1,
|
||||
&layers);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
if (layers)
|
||||
IDWriteColorGlyphRunEnumerator_Release(layers);
|
||||
|
||||
/* color font, glyph without color info */
|
||||
codepoints[0] = 'A';
|
||||
|
@ -5228,10 +5252,9 @@ todo_wine
|
|||
layers = (void*)0xdeadbeef;
|
||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0, 0.0, &run, NULL,
|
||||
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
||||
todo_wine {
|
||||
ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
|
||||
ok(layers == NULL, "got %p\n", layers);
|
||||
}
|
||||
|
||||
/* one glyph with, one without */
|
||||
codepoints[0] = 'A';
|
||||
codepoints[1] = 0x26c4;
|
||||
|
@ -5244,10 +5267,14 @@ todo_wine {
|
|||
layers = NULL;
|
||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0, 0.0, &run, NULL,
|
||||
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
||||
todo_wine {
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(layers != NULL, "got %p\n", layers);
|
||||
}
|
||||
if (layers)
|
||||
IDWriteColorGlyphRunEnumerator_Release(layers);
|
||||
|
||||
IDWriteFontFace2_Release(fontface2);
|
||||
IDWriteFontFace_Release(fontface);
|
||||
IDWriteFactory2_Release(factory2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue