[PATCH 1/5] d2d1: Implement d2d_d3d_render_target_CreateSolidColorBrush().

Jacek Caban jacek at codeweavers.com
Mon Jun 16 06:44:42 CDT 2014


Hi Henri,

On 06/16/14 13:13, Henri Verbeet wrote:
> diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
> index 5609db6..9e91728 100644
> --- a/dlls/d2d1/d2d1_private.h
> +++ b/dlls/d2d1/d2d1_private.h
> @@ -33,4 +33,13 @@ struct d2d_d3d_render_target
>  void d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, ID2D1Factory *factory,
>          IDXGISurface *surface, const D2D1_RENDER_TARGET_PROPERTIES *desc) DECLSPEC_HIDDEN;
>  
> +struct d2d_brush
> +{
> +    ID2D1Brush ID2D1Brush_iface;

Given how you use this object, this should be ID2D1SolidColorBrush. I
guess you want to somehow reuse this struct for other brush types, but
there should be better ways for this. Then:

+void d2d_solid_color_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target,
+        const D2D1_COLOR_F *color, const D2D1_BRUSH_PROPERTIES *desc)
+{
+    FIXME("Ignoring brush properties.\n");
+
+    brush->ID2D1Brush_iface.lpVtbl = (ID2D1BrushVtbl *)&d2d_solid_color_brush_vtbl;
+    brush->refcount = 1;
+}

This cast should not be needed.


> +    LONG refcount;
> +};
> +
> +void d2d_solid_color_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target,
> +        const D2D1_COLOR_F *color, const D2D1_BRUSH_PROPERTIES *desc) DECLSPEC_HIDDEN;
> +
>  #endif /* __WINE_D2D1_PRIVATE_H */
> diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
> index be9c1b6..e8c56a0 100644
> --- a/dlls/d2d1/render_target.c
> +++ b/dlls/d2d1/render_target.c
> @@ -117,9 +117,19 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateBitmapBrush(ID2D1Re
>  static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateSolidColorBrush(ID2D1RenderTarget *iface,
>          const D2D1_COLOR_F *color, const D2D1_BRUSH_PROPERTIES *desc, ID2D1SolidColorBrush **brush)
>  {
> -    FIXME("iface %p, color %p, desc %p, brush %p stub!\n", iface, color, desc, brush);
> +    struct d2d_brush *object;
>  
> -    return E_NOTIMPL;
> +    TRACE("iface %p, color %p, desc %p, brush %p.\n", iface, color, desc, brush);
> +
> +    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
> +        return E_OUTOFMEMORY;
> +
> +    d2d_solid_color_brush_init(object, iface, color, desc);
> +
> +    TRACE("Created brush %p.\n", object);
> +    *brush = (ID2D1SolidColorBrush *)&object->ID2D1Brush_iface;

Same here, the cast should not be needed. Also allocating memory in
brush.c seems more logical to me (although that's a matter of taste).

Cheers,
Jacek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20140616/b3b2e5a3/attachment.html>


More information about the wine-devel mailing list