ddraw/tests: Port test_transform_vertices to ddraw2 and ddraw4.
[wine.git] / dlls / d2d1 / stroke.c
blob167db679047c06dcc23495e7bd1e11d92df6ff49
1 /*
2 * Copyright 2014 Henri Verbeet for CodeWeavers
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.
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.
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
19 #include "config.h"
20 #include "wine/port.h"
22 #include "d2d1_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(d2d);
26 static inline struct d2d_stroke_style *impl_from_ID2D1StrokeStyle(ID2D1StrokeStyle *iface)
28 return CONTAINING_RECORD(iface, struct d2d_stroke_style, ID2D1StrokeStyle_iface);
31 static HRESULT STDMETHODCALLTYPE d2d_stroke_style_QueryInterface(ID2D1StrokeStyle *iface, REFIID iid, void **out)
33 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
35 if (IsEqualGUID(iid, &IID_ID2D1StrokeStyle)
36 || IsEqualGUID(iid, &IID_ID2D1Resource)
37 || IsEqualGUID(iid, &IID_IUnknown))
39 ID2D1StrokeStyle_AddRef(iface);
40 *out = iface;
41 return S_OK;
44 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
46 *out = NULL;
47 return E_NOINTERFACE;
50 static ULONG STDMETHODCALLTYPE d2d_stroke_style_AddRef(ID2D1StrokeStyle *iface)
52 struct d2d_stroke_style *style = impl_from_ID2D1StrokeStyle(iface);
53 ULONG refcount = InterlockedIncrement(&style->refcount);
55 TRACE("%p increasing refcount to %u.\n", iface, refcount);
57 return refcount;
60 static ULONG STDMETHODCALLTYPE d2d_stroke_style_Release(ID2D1StrokeStyle *iface)
62 struct d2d_stroke_style *style = impl_from_ID2D1StrokeStyle(iface);
63 ULONG refcount = InterlockedDecrement(&style->refcount);
65 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
67 if (!refcount)
69 ID2D1Factory_Release(style->factory);
70 HeapFree(GetProcessHeap(), 0, style);
73 return refcount;
76 static void STDMETHODCALLTYPE d2d_stroke_style_GetFactory(ID2D1StrokeStyle *iface, ID2D1Factory **factory)
78 struct d2d_stroke_style *style = impl_from_ID2D1StrokeStyle(iface);
80 TRACE("iface %p, factory %p.\n", iface, factory);
82 ID2D1Factory_AddRef(*factory = style->factory);
85 static D2D1_CAP_STYLE STDMETHODCALLTYPE d2d_stroke_style_GetStartCap(ID2D1StrokeStyle *iface)
87 FIXME("iface %p stub!\n", iface);
89 return D2D1_CAP_STYLE_FLAT;
92 static D2D1_CAP_STYLE STDMETHODCALLTYPE d2d_stroke_style_GetEndCap(ID2D1StrokeStyle *iface)
94 FIXME("iface %p stub!\n", iface);
96 return D2D1_CAP_STYLE_FLAT;
99 static D2D1_CAP_STYLE STDMETHODCALLTYPE d2d_stroke_style_GetDashCap(ID2D1StrokeStyle *iface)
101 FIXME("iface %p stub!\n", iface);
103 return D2D1_CAP_STYLE_FLAT;
106 static float STDMETHODCALLTYPE d2d_stroke_style_GetMiterLimit(ID2D1StrokeStyle *iface)
108 FIXME("iface %p stub!\n", iface);
110 return 0.0f;
113 static D2D1_LINE_JOIN STDMETHODCALLTYPE d2d_stroke_style_GetLineJoin(ID2D1StrokeStyle *iface)
115 FIXME("iface %p stub!\n", iface);
117 return D2D1_LINE_JOIN_MITER;
120 static float STDMETHODCALLTYPE d2d_stroke_style_GetDashOffset(ID2D1StrokeStyle *iface)
122 FIXME("iface %p stub!\n", iface);
124 return 0.0f;
127 static D2D1_DASH_STYLE STDMETHODCALLTYPE d2d_stroke_style_GetDashStyle(ID2D1StrokeStyle *iface)
129 FIXME("iface %p stub!\n", iface);
131 return D2D1_DASH_STYLE_SOLID;
134 static UINT32 STDMETHODCALLTYPE d2d_stroke_style_GetDashesCount(ID2D1StrokeStyle *iface)
136 FIXME("iface %p stub!\n", iface);
138 return 0;
141 static void STDMETHODCALLTYPE d2d_stroke_style_GetDashes(ID2D1StrokeStyle *iface, float *dashes, UINT32 count)
143 FIXME("iface %p, dashes %p, count %u stub!\n", iface, dashes, count);
146 static const struct ID2D1StrokeStyleVtbl d2d_stroke_style_vtbl =
148 d2d_stroke_style_QueryInterface,
149 d2d_stroke_style_AddRef,
150 d2d_stroke_style_Release,
151 d2d_stroke_style_GetFactory,
152 d2d_stroke_style_GetStartCap,
153 d2d_stroke_style_GetEndCap,
154 d2d_stroke_style_GetDashCap,
155 d2d_stroke_style_GetMiterLimit,
156 d2d_stroke_style_GetLineJoin,
157 d2d_stroke_style_GetDashOffset,
158 d2d_stroke_style_GetDashStyle,
159 d2d_stroke_style_GetDashesCount,
160 d2d_stroke_style_GetDashes,
163 void d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *factory,
164 const D2D1_STROKE_STYLE_PROPERTIES *desc, const float *dashes, UINT32 dash_count)
166 FIXME("Ignoring stroke style properties.\n");
168 style->ID2D1StrokeStyle_iface.lpVtbl = &d2d_stroke_style_vtbl;
169 style->refcount = 1;
170 ID2D1Factory_AddRef(style->factory = factory);