d2d1: Add support for opacity brushes.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
17daa1398e
commit
e6aa9f5041
|
@ -23,6 +23,13 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
|
||||
|
||||
struct d2d_bitmap_brush_cb
|
||||
{
|
||||
float _11, _21, _31, pad0;
|
||||
float _12, _22, _32, opacity;
|
||||
BOOL ignore_alpha, pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
static inline struct d2d_gradient *impl_from_ID2D1GradientStopCollection(ID2D1GradientStopCollection *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct d2d_gradient, ID2D1GradientStopCollection_iface);
|
||||
|
@ -730,45 +737,32 @@ static D3D10_TEXTURE_ADDRESS_MODE texture_address_mode_from_extend_mode(D2D1_EXT
|
|||
}
|
||||
}
|
||||
|
||||
HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target,
|
||||
ID3D10Buffer **ps_cb)
|
||||
static BOOL d2d_brush_fill_cb(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target, void *cb)
|
||||
{
|
||||
D3D10_SUBRESOURCE_DATA buffer_data;
|
||||
D3D10_BUFFER_DESC buffer_desc;
|
||||
struct
|
||||
{
|
||||
float _11, _21, _31, pad0;
|
||||
float _12, _22, _32, opacity;
|
||||
BOOL ignore_alpha;
|
||||
} bitmap_brush_cb;
|
||||
D2D1_COLOR_F color;
|
||||
HRESULT hr;
|
||||
|
||||
buffer_desc.Usage = D3D10_USAGE_DEFAULT;
|
||||
buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER;
|
||||
buffer_desc.CPUAccessFlags = 0;
|
||||
buffer_desc.MiscFlags = 0;
|
||||
|
||||
buffer_data.SysMemPitch = 0;
|
||||
buffer_data.SysMemSlicePitch = 0;
|
||||
struct d2d_bitmap_brush_cb *bitmap_brush_cb;
|
||||
D2D1_COLOR_F *color;
|
||||
|
||||
if (brush->type == D2D_BRUSH_TYPE_SOLID)
|
||||
{
|
||||
color = brush->u.solid.color;
|
||||
color.a *= brush->opacity;
|
||||
color.r *= color.a;
|
||||
color.g *= color.a;
|
||||
color.b *= color.a;
|
||||
color = cb;
|
||||
|
||||
buffer_desc.ByteWidth = sizeof(color);
|
||||
buffer_data.pSysMem = &color;
|
||||
*color = brush->u.solid.color;
|
||||
color->a *= brush->opacity;
|
||||
color->r *= color->a;
|
||||
color->g *= color->a;
|
||||
color->b *= color->a;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else if (brush->type == D2D_BRUSH_TYPE_BITMAP)
|
||||
|
||||
if (brush->type == D2D_BRUSH_TYPE_BITMAP)
|
||||
{
|
||||
struct d2d_bitmap *bitmap = brush->u.bitmap.bitmap;
|
||||
D2D_MATRIX_3X2_F w, b;
|
||||
float dpi_scale, d;
|
||||
|
||||
bitmap_brush_cb = cb;
|
||||
|
||||
/* Scale for dpi. */
|
||||
w = render_target->drawing_state.transform;
|
||||
dpi_scale = render_target->dpi_x / 96.0f;
|
||||
|
@ -797,47 +791,95 @@ HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_d3d_render_targe
|
|||
d = b._11 * b._22 - b._21 * b._12;
|
||||
if (d != 0.0f)
|
||||
{
|
||||
bitmap_brush_cb._11 = b._22 / d;
|
||||
bitmap_brush_cb._21 = -b._21 / d;
|
||||
bitmap_brush_cb._31 = (b._21 * b._32 - b._31 * b._22) / d;
|
||||
bitmap_brush_cb._12 = -b._12 / d;
|
||||
bitmap_brush_cb._22 = b._11 / d;
|
||||
bitmap_brush_cb._32 = -(b._11 * b._32 - b._31 * b._12) / d;
|
||||
bitmap_brush_cb->_11 = b._22 / d;
|
||||
bitmap_brush_cb->_21 = -b._21 / d;
|
||||
bitmap_brush_cb->_31 = (b._21 * b._32 - b._31 * b._22) / d;
|
||||
bitmap_brush_cb->_12 = -b._12 / d;
|
||||
bitmap_brush_cb->_22 = b._11 / d;
|
||||
bitmap_brush_cb->_32 = -(b._11 * b._32 - b._31 * b._12) / d;
|
||||
}
|
||||
bitmap_brush_cb.opacity = brush->opacity;
|
||||
bitmap_brush_cb.ignore_alpha = bitmap->format.alphaMode == D2D1_ALPHA_MODE_IGNORE;
|
||||
bitmap_brush_cb->opacity = brush->opacity;
|
||||
bitmap_brush_cb->ignore_alpha = bitmap->format.alphaMode == D2D1_ALPHA_MODE_IGNORE;
|
||||
|
||||
buffer_desc.ByteWidth = sizeof(bitmap_brush_cb);
|
||||
buffer_data.pSysMem = &bitmap_brush_cb;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
FIXME("Unhandled brush type %#x.\n", brush->type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_brush,
|
||||
struct d2d_d3d_render_target *render_target, ID3D10Buffer **ps_cb)
|
||||
{
|
||||
D3D10_SUBRESOURCE_DATA buffer_data;
|
||||
D3D10_BUFFER_DESC buffer_desc;
|
||||
BYTE *cb_data;
|
||||
HRESULT hr;
|
||||
|
||||
static const size_t brush_sizes[] =
|
||||
{
|
||||
/* D2D_BRUSH_TYPE_SOLID */ sizeof(D2D1_COLOR_F),
|
||||
/* D2D_BRUSH_TYPE_LINEAR */ 0,
|
||||
/* D2D_BRUSH_TYPE_BITMAP */ sizeof(struct d2d_bitmap_brush_cb),
|
||||
};
|
||||
|
||||
buffer_desc.Usage = D3D10_USAGE_DEFAULT;
|
||||
buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER;
|
||||
buffer_desc.CPUAccessFlags = 0;
|
||||
buffer_desc.MiscFlags = 0;
|
||||
|
||||
buffer_data.SysMemPitch = 0;
|
||||
buffer_data.SysMemSlicePitch = 0;
|
||||
|
||||
if (brush->type >= sizeof(brush_sizes) / sizeof(*brush_sizes))
|
||||
{
|
||||
ERR("Unhandled brush type %#x.\n", brush->type);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
buffer_desc.ByteWidth = brush_sizes[brush->type];
|
||||
if (opacity_brush)
|
||||
{
|
||||
if (opacity_brush->type >= sizeof(brush_sizes) / sizeof(*brush_sizes))
|
||||
{
|
||||
ERR("Unhandled opacity brush type %#x.\n", brush->type);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
buffer_desc.ByteWidth += brush_sizes[opacity_brush->type];
|
||||
}
|
||||
|
||||
if (!(cb_data = HeapAlloc(GetProcessHeap(), 0, buffer_desc.ByteWidth)))
|
||||
{
|
||||
ERR("Failed to allocate constant buffer data.\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
buffer_data.pSysMem = cb_data;
|
||||
|
||||
if (!d2d_brush_fill_cb(brush, render_target, cb_data))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, cb_data);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
cb_data += brush_sizes[brush->type];
|
||||
if (opacity_brush && !d2d_brush_fill_cb(opacity_brush, render_target, cb_data))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, cb_data);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, &buffer_desc, &buffer_data, ps_cb)))
|
||||
ERR("Failed to create constant buffer, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, cb_data);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target,
|
||||
enum d2d_shape_type shape_type)
|
||||
static void d2d_brush_bind_bitmap(struct d2d_brush *brush, ID3D10Device *device,
|
||||
unsigned int resource_idx, unsigned int sampler_idx)
|
||||
{
|
||||
static const float blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
ID3D10Device *device = render_target->device;
|
||||
ID3D10PixelShader *ps;
|
||||
HRESULT hr;
|
||||
|
||||
ID3D10Device_OMSetBlendState(device, render_target->bs, blend_factor, D3D10_DEFAULT_SAMPLE_MASK);
|
||||
if (!(ps = render_target->shape_resources[shape_type].ps[brush->type]))
|
||||
FIXME("No pixel shader for shape type %#x and brush type %#x.\n", shape_type, brush->type);
|
||||
ID3D10Device_PSSetShader(device, ps);
|
||||
|
||||
if (brush->type == D2D_BRUSH_TYPE_BITMAP)
|
||||
{
|
||||
ID3D10Device_PSSetShaderResources(device, 0, 1, &brush->u.bitmap.bitmap->view);
|
||||
ID3D10Device_PSSetShaderResources(device, resource_idx, 1, &brush->u.bitmap.bitmap->view);
|
||||
if (!brush->u.bitmap.sampler_state)
|
||||
{
|
||||
D3D10_SAMPLER_DESC sampler_desc;
|
||||
|
@ -863,10 +905,35 @@ void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_d3d_render_tar
|
|||
&sampler_desc, &brush->u.bitmap.sampler_state)))
|
||||
ERR("Failed to create sampler state, hr %#x.\n", hr);
|
||||
}
|
||||
ID3D10Device_PSSetSamplers(device, 0, 1, &brush->u.bitmap.sampler_state);
|
||||
}
|
||||
ID3D10Device_PSSetSamplers(device, sampler_idx, 1, &brush->u.bitmap.sampler_state);
|
||||
}
|
||||
|
||||
void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_brush *opacity_brush,
|
||||
struct d2d_d3d_render_target *render_target, enum d2d_shape_type shape_type)
|
||||
{
|
||||
static const float blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
unsigned int resource_idx = 0, sampler_idx = 0;
|
||||
ID3D10Device *device = render_target->device;
|
||||
enum d2d_brush_type opacity_brush_type;
|
||||
ID3D10PixelShader *ps;
|
||||
|
||||
ID3D10Device_OMSetBlendState(device, render_target->bs, blend_factor, D3D10_DEFAULT_SAMPLE_MASK);
|
||||
opacity_brush_type = opacity_brush ? opacity_brush->type : D2D_BRUSH_TYPE_COUNT;
|
||||
if (!(ps = render_target->shape_resources[shape_type].ps[brush->type][opacity_brush_type]))
|
||||
FIXME("No pixel shader for shape type %#x and brush types %#x/%#x.\n",
|
||||
shape_type, brush->type, opacity_brush_type);
|
||||
ID3D10Device_PSSetShader(device, ps);
|
||||
|
||||
if (brush->type == D2D_BRUSH_TYPE_BITMAP)
|
||||
d2d_brush_bind_bitmap(brush, device, resource_idx++, sampler_idx++);
|
||||
else if (brush->type != D2D_BRUSH_TYPE_SOLID)
|
||||
{
|
||||
FIXME("Unhandled brush type %#x.\n", brush->type);
|
||||
|
||||
if (opacity_brush)
|
||||
{
|
||||
if (opacity_brush->type == D2D_BRUSH_TYPE_BITMAP)
|
||||
d2d_brush_bind_bitmap(opacity_brush, device, resource_idx++, sampler_idx++);
|
||||
else if (opacity_brush->type != D2D_BRUSH_TYPE_SOLID)
|
||||
FIXME("Unhandled opacity brush type %#x.\n", opacity_brush->type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ struct d2d_shape_resources
|
|||
{
|
||||
ID3D10InputLayout *il;
|
||||
ID3D10VertexShader *vs;
|
||||
ID3D10PixelShader *ps[D2D_BRUSH_TYPE_COUNT];
|
||||
ID3D10PixelShader *ps[D2D_BRUSH_TYPE_COUNT][D2D_BRUSH_TYPE_COUNT + 1];
|
||||
};
|
||||
|
||||
struct d2d_d3d_render_target
|
||||
|
@ -163,10 +163,10 @@ void d2d_linear_gradient_brush_init(struct d2d_brush *brush, ID2D1Factory *facto
|
|||
void d2d_bitmap_brush_init(struct d2d_brush *brush, ID2D1Factory *factory,
|
||||
ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc,
|
||||
const D2D1_BRUSH_PROPERTIES *brush_desc) DECLSPEC_HIDDEN;
|
||||
void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target,
|
||||
enum d2d_shape_type shape_type) DECLSPEC_HIDDEN;
|
||||
HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target,
|
||||
ID3D10Buffer **ps_cb) DECLSPEC_HIDDEN;
|
||||
void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_brush *opacity_brush,
|
||||
struct d2d_d3d_render_target *render_target, enum d2d_shape_type shape_type) DECLSPEC_HIDDEN;
|
||||
HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_brush,
|
||||
struct d2d_d3d_render_target *render_target, ID3D10Buffer **ps_cb) DECLSPEC_HIDDEN;
|
||||
struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
struct d2d_stroke_style
|
||||
|
|
|
@ -127,9 +127,9 @@ static void d2d_clip_stack_pop(struct d2d_clip_stack *stack)
|
|||
--stack->count;
|
||||
}
|
||||
|
||||
static void d2d_draw(struct d2d_d3d_render_target *render_target, enum d2d_shape_type shape_type,
|
||||
static void d2d_rt_draw(struct d2d_d3d_render_target *render_target, enum d2d_shape_type shape_type,
|
||||
ID3D10Buffer *ib, unsigned int index_count, ID3D10Buffer *vb, unsigned int vb_stride,
|
||||
ID3D10Buffer *vs_cb, ID3D10Buffer *ps_cb, struct d2d_brush *brush)
|
||||
ID3D10Buffer *vs_cb, ID3D10Buffer *ps_cb, struct d2d_brush *brush, struct d2d_brush *opacity_brush)
|
||||
{
|
||||
struct d2d_shape_resources *shape_resources = &render_target->shape_resources[shape_type];
|
||||
ID3D10Device *device = render_target->device;
|
||||
|
@ -183,9 +183,9 @@ static void d2d_draw(struct d2d_d3d_render_target *render_target, enum d2d_shape
|
|||
ID3D10Device_RSSetState(device, render_target->rs);
|
||||
ID3D10Device_OMSetRenderTargets(device, 1, &render_target->view, NULL);
|
||||
if (brush)
|
||||
d2d_brush_bind_resources(brush, render_target, shape_type);
|
||||
d2d_brush_bind_resources(brush, opacity_brush, render_target, shape_type);
|
||||
else
|
||||
ID3D10Device_PSSetShader(device, shape_resources->ps[D2D_BRUSH_TYPE_SOLID]);
|
||||
ID3D10Device_PSSetShader(device, shape_resources->ps[D2D_BRUSH_TYPE_SOLID][D2D_BRUSH_TYPE_COUNT]);
|
||||
|
||||
if (ib)
|
||||
ID3D10Device_DrawIndexed(device, index_count, 0, 0);
|
||||
|
@ -239,7 +239,7 @@ static ULONG STDMETHODCALLTYPE d2d_d3d_render_target_Release(ID2D1RenderTarget *
|
|||
|
||||
if (!refcount)
|
||||
{
|
||||
unsigned int i, j;
|
||||
unsigned int i, j, k;
|
||||
|
||||
d2d_clip_stack_cleanup(&render_target->clip_stack);
|
||||
if (render_target->text_rendering_params)
|
||||
|
@ -252,8 +252,11 @@ static ULONG STDMETHODCALLTYPE d2d_d3d_render_target_Release(ID2D1RenderTarget *
|
|||
{
|
||||
for (j = 0; j < D2D_BRUSH_TYPE_COUNT; ++j)
|
||||
{
|
||||
if (render_target->shape_resources[i].ps[j])
|
||||
ID3D10PixelShader_Release(render_target->shape_resources[i].ps[j]);
|
||||
for (k = 0; k < D2D_BRUSH_TYPE_COUNT + 1; ++k)
|
||||
{
|
||||
if (render_target->shape_resources[i].ps[j][k])
|
||||
ID3D10PixelShader_Release(render_target->shape_resources[i].ps[j][k]);
|
||||
}
|
||||
}
|
||||
ID3D10VertexShader_Release(render_target->shape_resources[i].vs);
|
||||
ID3D10InputLayout_Release(render_target->shape_resources[i].il);
|
||||
|
@ -665,6 +668,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawGeometry(ID2D1RenderTarg
|
|||
static void STDMETHODCALLTYPE d2d_d3d_render_target_FillGeometry(ID2D1RenderTarget *iface,
|
||||
ID2D1Geometry *geometry, ID2D1Brush *brush, ID2D1Brush *opacity_brush)
|
||||
{
|
||||
struct d2d_brush *opacity_brush_impl = unsafe_impl_from_ID2D1Brush(opacity_brush);
|
||||
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
|
||||
struct d2d_brush *brush_impl = unsafe_impl_from_ID2D1Brush(brush);
|
||||
const struct d2d_geometry *geometry_impl;
|
||||
|
@ -693,9 +697,6 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillGeometry(ID2D1RenderTarg
|
|||
return;
|
||||
}
|
||||
|
||||
if (opacity_brush)
|
||||
FIXME("Ignoring opacity brush %p.\n", opacity_brush);
|
||||
|
||||
geometry_impl = unsafe_impl_from_ID2D1Geometry(geometry);
|
||||
|
||||
tmp_x = (2.0f * render_target->dpi_x) / (96.0f * render_target->pixel_size.width);
|
||||
|
@ -736,7 +737,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillGeometry(ID2D1RenderTarg
|
|||
return;
|
||||
}
|
||||
|
||||
if (FAILED(hr = d2d_brush_get_ps_cb(brush_impl, render_target, &ps_cb)))
|
||||
if (FAILED(hr = d2d_brush_get_ps_cb(brush_impl, opacity_brush_impl, render_target, &ps_cb)))
|
||||
{
|
||||
WARN("Failed to get ps constant buffer, hr %#x.\n", hr);
|
||||
ID3D10Buffer_Release(vs_cb);
|
||||
|
@ -766,8 +767,8 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillGeometry(ID2D1RenderTarg
|
|||
goto done;
|
||||
}
|
||||
|
||||
d2d_draw(render_target, D2D_SHAPE_TYPE_TRIANGLE, ib, 3 * geometry_impl->face_count, vb,
|
||||
sizeof(*geometry_impl->vertices), vs_cb, ps_cb, brush_impl);
|
||||
d2d_rt_draw(render_target, D2D_SHAPE_TYPE_TRIANGLE, ib, 3 * geometry_impl->face_count, vb,
|
||||
sizeof(*geometry_impl->vertices), vs_cb, ps_cb, brush_impl, opacity_brush_impl);
|
||||
|
||||
ID3D10Buffer_Release(vb);
|
||||
ID3D10Buffer_Release(ib);
|
||||
|
@ -784,8 +785,8 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillGeometry(ID2D1RenderTarg
|
|||
goto done;
|
||||
}
|
||||
|
||||
d2d_draw(render_target, D2D_SHAPE_TYPE_BEZIER, NULL, 3 * geometry_impl->bezier_count, vb,
|
||||
sizeof(*geometry_impl->beziers->v), vs_cb, ps_cb, brush_impl);
|
||||
d2d_rt_draw(render_target, D2D_SHAPE_TYPE_BEZIER, NULL, 3 * geometry_impl->bezier_count, vb,
|
||||
sizeof(*geometry_impl->beziers->v), vs_cb, ps_cb, brush_impl, opacity_brush_impl);
|
||||
|
||||
ID3D10Buffer_Release(vb);
|
||||
}
|
||||
|
@ -1228,8 +1229,8 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_Clear(ID2D1RenderTarget *ifa
|
|||
return;
|
||||
}
|
||||
|
||||
d2d_draw(render_target, D2D_SHAPE_TYPE_TRIANGLE, render_target->ib, 6,
|
||||
render_target->vb, render_target->vb_stride, vs_cb, ps_cb, NULL);
|
||||
d2d_rt_draw(render_target, D2D_SHAPE_TYPE_TRIANGLE, render_target->ib, 6,
|
||||
render_target->vb, render_target->vb_stride, vs_cb, ps_cb, NULL, NULL);
|
||||
|
||||
ID3D10Buffer_Release(ps_cb);
|
||||
ID3D10Buffer_Release(vs_cb);
|
||||
|
@ -1549,7 +1550,7 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target,
|
|||
D3D10_BUFFER_DESC buffer_desc;
|
||||
D3D10_BLEND_DESC blend_desc;
|
||||
ID3D10Resource *resource;
|
||||
unsigned int i, j;
|
||||
unsigned int i, j, k;
|
||||
HRESULT hr;
|
||||
|
||||
static const D3D10_INPUT_ELEMENT_DESC il_desc_triangle[] =
|
||||
|
@ -1785,7 +1786,7 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target,
|
|||
|
||||
if (FAILED(hr = ID3D10Device_CreatePixelShader(render_target->device,
|
||||
ps_code_triangle_solid, sizeof(ps_code_triangle_solid),
|
||||
&render_target->shape_resources[D2D_SHAPE_TYPE_TRIANGLE].ps[D2D_BRUSH_TYPE_SOLID])))
|
||||
&render_target->shape_resources[D2D_SHAPE_TYPE_TRIANGLE].ps[D2D_BRUSH_TYPE_SOLID][D2D_BRUSH_TYPE_COUNT])))
|
||||
{
|
||||
WARN("Failed to create triangle/solid pixel shader, hr %#x.\n", hr);
|
||||
goto err;
|
||||
|
@ -1793,7 +1794,7 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target,
|
|||
|
||||
if (FAILED(hr = ID3D10Device_CreatePixelShader(render_target->device,
|
||||
ps_code_triangle_bitmap, sizeof(ps_code_triangle_bitmap),
|
||||
&render_target->shape_resources[D2D_SHAPE_TYPE_TRIANGLE].ps[D2D_BRUSH_TYPE_BITMAP])))
|
||||
&render_target->shape_resources[D2D_SHAPE_TYPE_TRIANGLE].ps[D2D_BRUSH_TYPE_BITMAP][D2D_BRUSH_TYPE_COUNT])))
|
||||
{
|
||||
WARN("Failed to create triangle/bitmap pixel shader, hr %#x.\n", hr);
|
||||
goto err;
|
||||
|
@ -1801,7 +1802,7 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target,
|
|||
|
||||
if (FAILED(hr = ID3D10Device_CreatePixelShader(render_target->device,
|
||||
ps_code_bezier_solid, sizeof(ps_code_bezier_solid),
|
||||
&render_target->shape_resources[D2D_SHAPE_TYPE_BEZIER].ps[D2D_BRUSH_TYPE_SOLID])))
|
||||
&render_target->shape_resources[D2D_SHAPE_TYPE_BEZIER].ps[D2D_BRUSH_TYPE_SOLID][D2D_BRUSH_TYPE_COUNT])))
|
||||
{
|
||||
WARN("Failed to create bezier/solid pixel shader, hr %#x.\n", hr);
|
||||
goto err;
|
||||
|
@ -1917,8 +1918,11 @@ err:
|
|||
{
|
||||
for (j = 0; j < D2D_BRUSH_TYPE_COUNT; ++j)
|
||||
{
|
||||
if (render_target->shape_resources[i].ps[j])
|
||||
ID3D10PixelShader_Release(render_target->shape_resources[i].ps[j]);
|
||||
for (k = 0; k < D2D_BRUSH_TYPE_COUNT + 1; ++k)
|
||||
{
|
||||
if (render_target->shape_resources[i].ps[j][k])
|
||||
ID3D10PixelShader_Release(render_target->shape_resources[i].ps[j][k]);
|
||||
}
|
||||
}
|
||||
if (render_target->shape_resources[i].vs)
|
||||
ID3D10VertexShader_Release(render_target->shape_resources[i].vs);
|
||||
|
|
Loading…
Reference in New Issue