d2d1: Validate brush types in d2d_d3d_render_target_FillGeometry().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2015-11-18 16:10:20 +01:00 committed by Alexandre Julliard
parent cb2f6fbfe5
commit 17daa1398e
2 changed files with 27 additions and 3 deletions

View File

@ -52,6 +52,12 @@ struct d2d_clip_stack
unsigned int count;
};
struct d2d_error_state
{
HRESULT code;
D2D1_TAG tag1, tag2;
};
struct d2d_shape_resources
{
ID3D10InputLayout *il;
@ -76,6 +82,7 @@ struct d2d_d3d_render_target
ID3D10RasterizerState *rs;
ID3D10BlendState *bs;
struct d2d_error_state error;
D2D1_DRAWING_STATE_DESCRIPTION drawing_state;
IDWriteRenderingParams *text_rendering_params;

View File

@ -682,6 +682,17 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillGeometry(ID2D1RenderTarg
TRACE("iface %p, geometry %p, brush %p, opacity_brush %p.\n", iface, geometry, brush, opacity_brush);
if (FAILED(render_target->error.code))
return;
if (opacity_brush && brush_impl->type != D2D_BRUSH_TYPE_BITMAP)
{
render_target->error.code = D2DERR_INCOMPATIBLE_BRUSH_TYPES;
render_target->error.tag1 = render_target->drawing_state.tag1;
render_target->error.tag2 = render_target->drawing_state.tag2;
return;
}
if (opacity_brush)
FIXME("Ignoring opacity brush %p.\n", opacity_brush);
@ -1226,20 +1237,26 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_Clear(ID2D1RenderTarget *ifa
static void STDMETHODCALLTYPE d2d_d3d_render_target_BeginDraw(ID2D1RenderTarget *iface)
{
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
TRACE("iface %p.\n", iface);
memset(&render_target->error, 0, sizeof(render_target->error));
}
static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_EndDraw(ID2D1RenderTarget *iface,
D2D1_TAG *tag1, D2D1_TAG *tag2)
{
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
TRACE("iface %p, tag1 %p, tag2 %p.\n", iface, tag1, tag2);
if (tag1)
*tag1 = 0;
*tag1 = render_target->error.tag1;
if (tag2)
*tag2 = 0;
*tag1 = render_target->error.tag2;
return S_OK;
return render_target->error.code;
}
static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_d3d_render_target_GetPixelFormat(ID2D1RenderTarget *iface,