d2d1: Implement d2d_d3d_render_target_CreateMesh().

This commit is contained in:
Henri Verbeet 2014-09-16 10:44:12 +02:00 committed by Alexandre Julliard
parent c5af3d912b
commit be415203c7
4 changed files with 121 additions and 2 deletions

View File

@ -5,6 +5,7 @@ IMPORTS = d3d10_1 dxguid uuid
C_SRCS = \
brush.c \
factory.c \
mesh.c \
render_target.c \
stroke.c \
wic_render_target.c

View File

@ -107,4 +107,12 @@ struct d2d_stroke_style
void d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *factory,
const D2D1_STROKE_STYLE_PROPERTIES *desc, const float *dashes, UINT32 dash_count) DECLSPEC_HIDDEN;
struct d2d_mesh
{
ID2D1Mesh ID2D1Mesh_iface;
LONG refcount;
};
void d2d_mesh_init(struct d2d_mesh *mesh) DECLSPEC_HIDDEN;
#endif /* __WINE_D2D1_PRIVATE_H */

100
dlls/d2d1/mesh.c Normal file
View File

@ -0,0 +1,100 @@
/*
* Copyright 2014 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "d2d1_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
static inline struct d2d_mesh *impl_from_ID2D1Mesh(ID2D1Mesh *iface)
{
return CONTAINING_RECORD(iface, struct d2d_mesh, ID2D1Mesh_iface);
}
static HRESULT STDMETHODCALLTYPE d2d_mesh_QueryInterface(ID2D1Mesh *iface, REFIID iid, void **out)
{
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_ID2D1Mesh)
|| IsEqualGUID(iid, &IID_ID2D1Resource)
|| IsEqualGUID(iid, &IID_IUnknown))
{
ID2D1Mesh_AddRef(iface);
*out = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
*out = NULL;
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE d2d_mesh_AddRef(ID2D1Mesh *iface)
{
struct d2d_mesh *mesh = impl_from_ID2D1Mesh(iface);
ULONG refcount = InterlockedIncrement(&mesh->refcount);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
return refcount;
}
static ULONG STDMETHODCALLTYPE d2d_mesh_Release(ID2D1Mesh *iface)
{
struct d2d_mesh *mesh = impl_from_ID2D1Mesh(iface);
ULONG refcount = InterlockedDecrement(&mesh->refcount);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
HeapFree(GetProcessHeap(), 0, mesh);
return refcount;
}
static void STDMETHODCALLTYPE d2d_mesh_GetFactory(ID2D1Mesh *iface, ID2D1Factory **factory)
{
FIXME("iface %p, factory %p stub!\n", iface, factory);
*factory = NULL;
}
static HRESULT STDMETHODCALLTYPE d2d_mesh_Open(ID2D1Mesh *iface, ID2D1TessellationSink **sink)
{
FIXME("iface %p, sink %p stub!\n", iface, sink);
return E_NOTIMPL;
}
static const struct ID2D1MeshVtbl d2d_mesh_vtbl =
{
d2d_mesh_QueryInterface,
d2d_mesh_AddRef,
d2d_mesh_Release,
d2d_mesh_GetFactory,
d2d_mesh_Open,
};
void d2d_mesh_init(struct d2d_mesh *mesh)
{
mesh->ID2D1Mesh_iface.lpVtbl = &d2d_mesh_vtbl;
mesh->refcount = 1;
}

View File

@ -304,9 +304,19 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateLayer(ID2D1RenderTa
static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateMesh(ID2D1RenderTarget *iface, ID2D1Mesh **mesh)
{
FIXME("iface %p, mesh %p stub!\n", iface, mesh);
struct d2d_mesh *object;
return E_NOTIMPL;
TRACE("iface %p, mesh %p.\n", iface, mesh);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
d2d_mesh_init(object);
TRACE("Created mesh %p.\n", object);
*mesh = &object->ID2D1Mesh_iface;
return S_OK;
}
static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawLine(ID2D1RenderTarget *iface,