d2d1: d2d_bitmap_brush_init() can't fail.

This commit is contained in:
Henri Verbeet 2015-08-12 17:37:11 +02:00 committed by Alexandre Julliard
parent 7bdc1ef899
commit 64ccd138a2
3 changed files with 3 additions and 11 deletions

View File

@ -683,7 +683,7 @@ static const struct ID2D1BitmapBrushVtbl d2d_bitmap_brush_vtbl =
d2d_bitmap_brush_GetBitmap, d2d_bitmap_brush_GetBitmap,
}; };
HRESULT d2d_bitmap_brush_init(struct d2d_brush *brush, ID2D1Factory *factory, ID2D1Bitmap *bitmap, 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) const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc)
{ {
d2d_brush_init(brush, factory, D2D_BRUSH_TYPE_BITMAP, d2d_brush_init(brush, factory, D2D_BRUSH_TYPE_BITMAP,
@ -702,8 +702,6 @@ HRESULT d2d_bitmap_brush_init(struct d2d_brush *brush, ID2D1Factory *factory, ID
brush->u.bitmap.extend_mode_y = D2D1_EXTEND_MODE_CLAMP; brush->u.bitmap.extend_mode_y = D2D1_EXTEND_MODE_CLAMP;
brush->u.bitmap.interpolation_mode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR; brush->u.bitmap.interpolation_mode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR;
} }
return S_OK;
} }
struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface) struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface)

View File

@ -153,7 +153,7 @@ void d2d_solid_color_brush_init(struct d2d_brush *brush, ID2D1Factory *factory,
void d2d_linear_gradient_brush_init(struct d2d_brush *brush, ID2D1Factory *factory, void d2d_linear_gradient_brush_init(struct d2d_brush *brush, ID2D1Factory *factory,
const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
ID2D1GradientStopCollection *gradient) DECLSPEC_HIDDEN; ID2D1GradientStopCollection *gradient) DECLSPEC_HIDDEN;
HRESULT d2d_bitmap_brush_init(struct d2d_brush *brush, ID2D1Factory *factory, void d2d_bitmap_brush_init(struct d2d_brush *brush, ID2D1Factory *factory,
ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc, ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc,
const D2D1_BRUSH_PROPERTIES *brush_desc) DECLSPEC_HIDDEN; const D2D1_BRUSH_PROPERTIES *brush_desc) DECLSPEC_HIDDEN;
void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target, void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target,

View File

@ -435,7 +435,6 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateBitmapBrush(ID2D1Re
{ {
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface); struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
struct d2d_brush *object; struct d2d_brush *object;
HRESULT hr;
TRACE("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p.\n", TRACE("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p.\n",
iface, bitmap, bitmap_brush_desc, brush_desc, brush); iface, bitmap, bitmap_brush_desc, brush_desc, brush);
@ -443,12 +442,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateBitmapBrush(ID2D1Re
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d2d_bitmap_brush_init(object, render_target->factory, bitmap, bitmap_brush_desc, brush_desc))) d2d_bitmap_brush_init(object, render_target->factory, bitmap, bitmap_brush_desc, brush_desc);
{
WARN("Failed to initialize brush, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
TRACE("Created brush %p.\n", object); TRACE("Created brush %p.\n", object);
*brush = (ID2D1BitmapBrush *)&object->ID2D1Brush_iface; *brush = (ID2D1BitmapBrush *)&object->ID2D1Brush_iface;