Henri Verbeet : d2d1: d2d_bitmap_brush_init() can't fail.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 13 04:23:49 CDT 2015


Module: wine
Branch: master
Commit: 64ccd138a2cf147070061ebf06753f12a9d452ba
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=64ccd138a2cf147070061ebf06753f12a9d452ba

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Aug 12 17:37:11 2015 +0200

d2d1: d2d_bitmap_brush_init() can't fail.

---

 dlls/d2d1/brush.c         | 4 +---
 dlls/d2d1/d2d1_private.h  | 2 +-
 dlls/d2d1/render_target.c | 8 +-------
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c
index 2535f85..f450f24 100644
--- a/dlls/d2d1/brush.c
+++ b/dlls/d2d1/brush.c
@@ -683,7 +683,7 @@ static const struct ID2D1BitmapBrushVtbl d2d_bitmap_brush_vtbl =
     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)
 {
     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.interpolation_mode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR;
     }
-
-    return S_OK;
 }
 
 struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 6553eeb..4ba41e0 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -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,
         const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
         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,
         const D2D1_BRUSH_PROPERTIES *brush_desc) DECLSPEC_HIDDEN;
 void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target,
diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
index df9a898..263cb91 100644
--- a/dlls/d2d1/render_target.c
+++ b/dlls/d2d1/render_target.c
@@ -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_brush *object;
-    HRESULT hr;
 
     TRACE("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p.\n",
             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))))
         return E_OUTOFMEMORY;
 
-    if (FAILED(hr = 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;
-    }
+    d2d_bitmap_brush_init(object, render_target->factory, bitmap, bitmap_brush_desc, brush_desc);
 
     TRACE("Created brush %p.\n", object);
     *brush = (ID2D1BitmapBrush *)&object->ID2D1Brush_iface;




More information about the wine-cvs mailing list