ReactOS 0.4.17-dev-934-g091855f
mesh.c
Go to the documentation of this file.
1/*
2 * Copyright 2014 Henri Verbeet for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include "d2d1_private.h"
20
22
23static inline struct d2d_mesh *impl_from_ID2D1Mesh(ID2D1Mesh *iface)
24{
25 return CONTAINING_RECORD(iface, struct d2d_mesh, ID2D1Mesh_iface);
26}
27
29{
30 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
31
32 if (IsEqualGUID(iid, &IID_ID2D1Mesh)
33 || IsEqualGUID(iid, &IID_ID2D1Resource)
34 || IsEqualGUID(iid, &IID_IUnknown))
35 {
36 ID2D1Mesh_AddRef(iface);
37 *out = iface;
38 return S_OK;
39 }
40
41 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
42
43 *out = NULL;
44 return E_NOINTERFACE;
45}
46
48{
49 struct d2d_mesh *mesh = impl_from_ID2D1Mesh(iface);
51
52 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
53
54 return refcount;
55}
56
58{
59 struct d2d_mesh *mesh = impl_from_ID2D1Mesh(iface);
61
62 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
63
64 if (!refcount)
65 {
66 ID2D1Factory_Release(mesh->factory);
67 free(mesh);
68 }
69
70 return refcount;
71}
72
74{
75 struct d2d_mesh *mesh = impl_from_ID2D1Mesh(iface);
76
77 TRACE("iface %p, factory %p.\n", iface, factory);
78
79 ID2D1Factory_AddRef(*factory = mesh->factory);
80}
81
83{
84 FIXME("iface %p, sink %p stub!\n", iface, sink);
85
86 return E_NOTIMPL;
87}
88
89static const struct ID2D1MeshVtbl d2d_mesh_vtbl =
90{
96};
97
99{
100 if (!(*mesh = calloc(1, sizeof(**mesh))))
101 return E_OUTOFMEMORY;
102
103 (*mesh)->ID2D1Mesh_iface.lpVtbl = &d2d_mesh_vtbl;
104 (*mesh)->refcount = 1;
105 ID2D1Factory_AddRef((*mesh)->factory = factory);
106
107 TRACE("Created mesh %p.\n", *mesh);
108 return S_OK;
109}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
static const struct ID2D1MeshVtbl d2d_mesh_vtbl
Definition: mesh.c:89
static ULONG STDMETHODCALLTYPE d2d_mesh_Release(ID2D1Mesh *iface)
Definition: mesh.c:57
static HRESULT STDMETHODCALLTYPE d2d_mesh_Open(ID2D1Mesh *iface, ID2D1TessellationSink **sink)
Definition: mesh.c:82
static HRESULT STDMETHODCALLTYPE d2d_mesh_QueryInterface(ID2D1Mesh *iface, REFIID iid, void **out)
Definition: mesh.c:28
static ULONG STDMETHODCALLTYPE d2d_mesh_AddRef(ID2D1Mesh *iface)
Definition: mesh.c:47
static struct d2d_mesh * impl_from_ID2D1Mesh(ID2D1Mesh *iface)
Definition: mesh.c:23
static void STDMETHODCALLTYPE d2d_mesh_GetFactory(ID2D1Mesh *iface, ID2D1Factory **factory)
Definition: mesh.c:73
HRESULT d2d_mesh_create(ID2D1Factory *factory, struct d2d_mesh **mesh)
Definition: mesh.c:98
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define calloc
Definition: rosglue.h:14
#define TRACE(s)
Definition: solgame.cpp:4
LONG refcount
Definition: d2d1_private.h:416
ID2D1Mesh ID2D1Mesh_iface
Definition: d2d1_private.h:415
Definition: main.c:439
Definition: mesh.c:189
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define E_NOINTERFACE
Definition: winerror.h:3479