2 * Copyright 2015 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
20 #include "wine/port.h"
22 #include "d2d1_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(d2d
);
26 static inline struct d2d_geometry
*impl_from_ID2D1GeometrySink(ID2D1GeometrySink
*iface
)
28 return CONTAINING_RECORD(iface
, struct d2d_geometry
, ID2D1GeometrySink_iface
);
31 static HRESULT STDMETHODCALLTYPE
d2d_geometry_sink_QueryInterface(ID2D1GeometrySink
*iface
, REFIID iid
, void **out
)
33 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
35 if (IsEqualGUID(iid
, &IID_ID2D1GeometrySink
)
36 || IsEqualGUID(iid
, &IID_ID2D1SimplifiedGeometrySink
)
37 || IsEqualGUID(iid
, &IID_IUnknown
))
39 ID2D1GeometrySink_AddRef(iface
);
44 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
50 static ULONG STDMETHODCALLTYPE
d2d_geometry_sink_AddRef(ID2D1GeometrySink
*iface
)
52 struct d2d_geometry
*geometry
= impl_from_ID2D1GeometrySink(iface
);
54 TRACE("iface %p.\n", iface
);
56 return ID2D1Geometry_AddRef(&geometry
->ID2D1Geometry_iface
);
59 static ULONG STDMETHODCALLTYPE
d2d_geometry_sink_Release(ID2D1GeometrySink
*iface
)
61 struct d2d_geometry
*geometry
= impl_from_ID2D1GeometrySink(iface
);
63 TRACE("iface %p.\n", iface
);
65 return ID2D1Geometry_Release(&geometry
->ID2D1Geometry_iface
);
68 static void STDMETHODCALLTYPE
d2d_geometry_sink_SetFillMode(ID2D1GeometrySink
*iface
, D2D1_FILL_MODE mode
)
70 FIXME("iface %p, mode %#x stub!\n", iface
, mode
);
73 static void STDMETHODCALLTYPE
d2d_geometry_sink_SetSegmentFlags(ID2D1GeometrySink
*iface
, D2D1_PATH_SEGMENT flags
)
75 FIXME("iface %p, flags %#x stub!\n", iface
, flags
);
78 static void STDMETHODCALLTYPE
d2d_geometry_sink_BeginFigure(ID2D1GeometrySink
*iface
,
79 D2D1_POINT_2F start_point
, D2D1_FIGURE_BEGIN figure_begin
)
81 FIXME("iface %p, start_point {%.8e, %.8e}, figure_begin %#x stub!\n",
82 iface
, start_point
.x
, start_point
.y
, figure_begin
);
85 static void STDMETHODCALLTYPE
d2d_geometry_sink_AddLines(ID2D1GeometrySink
*iface
,
86 const D2D1_POINT_2F
*points
, UINT32 count
)
88 FIXME("iface %p, points %p, count %u stub!\n", iface
, points
, count
);
91 static void STDMETHODCALLTYPE
d2d_geometry_sink_AddBeziers(ID2D1GeometrySink
*iface
,
92 const D2D1_BEZIER_SEGMENT
*beziers
, UINT32 count
)
94 FIXME("iface %p, beziers %p, count %u stub!\n", iface
, beziers
, count
);
97 static void STDMETHODCALLTYPE
d2d_geometry_sink_EndFigure(ID2D1GeometrySink
*iface
, D2D1_FIGURE_END figure_end
)
99 FIXME("iface %p, figure_end %#x stub!\n", iface
, figure_end
);
102 static HRESULT STDMETHODCALLTYPE
d2d_geometry_sink_Close(ID2D1GeometrySink
*iface
)
104 FIXME("iface %p stub!\n", iface
);
109 static void STDMETHODCALLTYPE
d2d_geometry_sink_AddLine(ID2D1GeometrySink
*iface
, D2D1_POINT_2F point
)
111 TRACE("iface %p, point {%.8e, %.8e}.\n", iface
, point
.x
, point
.y
);
113 d2d_geometry_sink_AddLines(iface
, &point
, 1);
116 static void STDMETHODCALLTYPE
d2d_geometry_sink_AddBezier(ID2D1GeometrySink
*iface
, const D2D1_BEZIER_SEGMENT
*bezier
)
118 TRACE("iface %p, bezier %p.\n", iface
, bezier
);
120 d2d_geometry_sink_AddBeziers(iface
, bezier
, 1);
123 static void STDMETHODCALLTYPE
d2d_geometry_sink_AddQuadraticBezier(ID2D1GeometrySink
*iface
,
124 const D2D1_QUADRATIC_BEZIER_SEGMENT
*bezier
)
126 TRACE("iface %p, bezier %p.\n", iface
, bezier
);
128 ID2D1GeometrySink_AddQuadraticBeziers(iface
, bezier
, 1);
131 static void STDMETHODCALLTYPE
d2d_geometry_sink_AddQuadraticBeziers(ID2D1GeometrySink
*iface
,
132 const D2D1_QUADRATIC_BEZIER_SEGMENT
*beziers
, UINT32 bezier_count
)
134 FIXME("iface %p, beziers %p, bezier_count %u stub!\n", iface
, beziers
, bezier_count
);
137 static void STDMETHODCALLTYPE
d2d_geometry_sink_AddArc(ID2D1GeometrySink
*iface
, const D2D1_ARC_SEGMENT
*arc
)
139 FIXME("iface %p, arc %p stub!\n", iface
, arc
);
142 struct ID2D1GeometrySinkVtbl d2d_geometry_sink_vtbl
=
144 d2d_geometry_sink_QueryInterface
,
145 d2d_geometry_sink_AddRef
,
146 d2d_geometry_sink_Release
,
147 d2d_geometry_sink_SetFillMode
,
148 d2d_geometry_sink_SetSegmentFlags
,
149 d2d_geometry_sink_BeginFigure
,
150 d2d_geometry_sink_AddLines
,
151 d2d_geometry_sink_AddBeziers
,
152 d2d_geometry_sink_EndFigure
,
153 d2d_geometry_sink_Close
,
154 d2d_geometry_sink_AddLine
,
155 d2d_geometry_sink_AddBezier
,
156 d2d_geometry_sink_AddQuadraticBezier
,
157 d2d_geometry_sink_AddQuadraticBeziers
,
158 d2d_geometry_sink_AddArc
,
161 static inline struct d2d_geometry
*impl_from_ID2D1PathGeometry(ID2D1PathGeometry
*iface
)
163 return CONTAINING_RECORD(iface
, struct d2d_geometry
, ID2D1Geometry_iface
);
166 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_QueryInterface(ID2D1PathGeometry
*iface
, REFIID iid
, void **out
)
168 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
170 if (IsEqualGUID(iid
, &IID_ID2D1PathGeometry
)
171 || IsEqualGUID(iid
, &IID_ID2D1Geometry
)
172 || IsEqualGUID(iid
, &IID_ID2D1Resource
)
173 || IsEqualGUID(iid
, &IID_IUnknown
))
175 ID2D1PathGeometry_AddRef(iface
);
180 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
183 return E_NOINTERFACE
;
186 static ULONG STDMETHODCALLTYPE
d2d_path_geometry_AddRef(ID2D1PathGeometry
*iface
)
188 struct d2d_geometry
*geometry
= impl_from_ID2D1PathGeometry(iface
);
189 ULONG refcount
= InterlockedIncrement(&geometry
->refcount
);
191 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
196 static ULONG STDMETHODCALLTYPE
d2d_path_geometry_Release(ID2D1PathGeometry
*iface
)
198 struct d2d_geometry
*geometry
= impl_from_ID2D1PathGeometry(iface
);
199 ULONG refcount
= InterlockedDecrement(&geometry
->refcount
);
201 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
204 HeapFree(GetProcessHeap(), 0, geometry
);
209 static void STDMETHODCALLTYPE
d2d_path_geometry_GetFactory(ID2D1PathGeometry
*iface
, ID2D1Factory
**factory
)
211 FIXME("iface %p, factory %p stub!\n", iface
, factory
);
216 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_GetBounds(ID2D1PathGeometry
*iface
,
217 const D2D1_MATRIX_3X2_F
*transform
, D2D1_RECT_F
*bounds
)
219 FIXME("iface %p, transform %p, bounds %p stub!\n", iface
, transform
, bounds
);
224 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_GetWidenedBounds(ID2D1PathGeometry
*iface
, float stroke_width
,
225 ID2D1StrokeStyle
*stroke_style
, const D2D1_MATRIX_3X2_F
*transform
, float tolerance
, D2D1_RECT_F
*bounds
)
227 FIXME("iface %p, stroke_width %.8e, stroke_style %p, transform %p, tolerance %.8e, bounds %p stub!\n",
228 iface
, stroke_width
, stroke_style
, transform
, tolerance
, bounds
);
233 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_StrokeContainsPoint(ID2D1PathGeometry
*iface
,
234 D2D1_POINT_2F point
, float stroke_width
, ID2D1StrokeStyle
*stroke_style
, const D2D1_MATRIX_3X2_F
*transform
,
235 float tolerance
, BOOL
*contains
)
237 FIXME("iface %p, point {%.8e, %.8e}, stroke_width %.8e, stroke_style %p, "
238 "transform %p, tolerance %.8e, contains %p stub!\n",
239 iface
, point
.x
, point
.y
, stroke_width
, stroke_style
, transform
, tolerance
, contains
);
244 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_FillContainsPoint(ID2D1PathGeometry
*iface
,
245 D2D1_POINT_2F point
, const D2D1_MATRIX_3X2_F
*transform
, float tolerance
, BOOL
*contains
)
247 FIXME("iface %p, point {%.8e, %.8e}, transform %p, tolerance %.8e, contains %p stub!\n",
248 iface
, point
.x
, point
.y
, transform
, tolerance
, contains
);
253 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_CompareWithGeometry(ID2D1PathGeometry
*iface
,
254 ID2D1Geometry
*geometry
, const D2D1_MATRIX_3X2_F
*transform
, float tolerance
, D2D1_GEOMETRY_RELATION
*relation
)
256 FIXME("iface %p, geometry %p, transform %p, tolerance %.8e, relation %p stub!\n",
257 iface
, geometry
, transform
, tolerance
, relation
);
262 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_Simplify(ID2D1PathGeometry
*iface
,
263 D2D1_GEOMETRY_SIMPLIFICATION_OPTION option
, const D2D1_MATRIX_3X2_F
*transform
, float tolerance
,
264 ID2D1SimplifiedGeometrySink
*sink
)
266 FIXME("iface %p, option %#x, transform %p, tolerance %.8e, sink %p stub!\n",
267 iface
, option
, transform
, tolerance
, sink
);
272 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_Tessellate(ID2D1PathGeometry
*iface
,
273 const D2D1_MATRIX_3X2_F
*transform
, float tolerance
, ID2D1TessellationSink
*sink
)
275 FIXME("iface %p, transform %p, tolerance %.8e, sink %p stub!\n", iface
, transform
, tolerance
, sink
);
280 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_CombineWithGeometry(ID2D1PathGeometry
*iface
,
281 ID2D1Geometry
*geometry
, D2D1_COMBINE_MODE combine_mode
, const D2D1_MATRIX_3X2_F
*transform
,
282 float tolerance
, ID2D1SimplifiedGeometrySink
*sink
)
284 FIXME("iface %p, geometry %p, combine_mode %#x, transform %p, tolerance %.8e, sink %p stub!\n",
285 iface
, geometry
, combine_mode
, transform
, tolerance
, sink
);
290 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_Outline(ID2D1PathGeometry
*iface
,
291 const D2D1_MATRIX_3X2_F
*transform
, float tolerance
, ID2D1SimplifiedGeometrySink
*sink
)
293 FIXME("iface %p, transform %p, tolerance %.8e, sink %p stub!\n", iface
, transform
, tolerance
, sink
);
298 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_ComputeArea(ID2D1PathGeometry
*iface
,
299 const D2D1_MATRIX_3X2_F
*transform
, float tolerance
, float *area
)
301 FIXME("iface %p, transform %p, tolerance %.8e, area %p stub!\n", iface
, transform
, tolerance
, area
);
306 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_ComputeLength(ID2D1PathGeometry
*iface
,
307 const D2D1_MATRIX_3X2_F
*transform
, float tolerance
, float *length
)
309 FIXME("iface %p, transform %p, tolerance %.8e, length %p stub!\n", iface
, transform
, tolerance
, length
);
314 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_ComputePointAtLength(ID2D1PathGeometry
*iface
, float length
,
315 const D2D1_MATRIX_3X2_F
*transform
, float tolerance
, D2D1_POINT_2F
*point
, D2D1_POINT_2F
*tangent
)
317 FIXME("iface %p, length %.8e, transform %p, tolerance %.8e, point %p, tangent %p stub!\n",
318 iface
, length
, transform
, tolerance
, point
, tangent
);
323 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_Widen(ID2D1PathGeometry
*iface
, float stroke_width
,
324 ID2D1StrokeStyle
*stroke_style
, const D2D1_MATRIX_3X2_F
*transform
, float tolerance
,
325 ID2D1SimplifiedGeometrySink
*sink
)
327 FIXME("iface %p, stroke_width %.8e, stroke_style %p, transform %p, tolerance %.8e, sink %p stub!\n",
328 iface
, stroke_width
, stroke_style
, transform
, tolerance
, sink
);
333 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_Open(ID2D1PathGeometry
*iface
, ID2D1GeometrySink
**sink
)
335 struct d2d_geometry
*geometry
= impl_from_ID2D1PathGeometry(iface
);
337 TRACE("iface %p, sink %p.\n", iface
, sink
);
339 *sink
= &geometry
->ID2D1GeometrySink_iface
;
340 ID2D1GeometrySink_AddRef(*sink
);
345 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_Stream(ID2D1PathGeometry
*iface
, ID2D1GeometrySink
*sink
)
347 FIXME("iface %p, sink %p stub!\n", iface
, sink
);
352 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_GetSegmentCount(ID2D1PathGeometry
*iface
, UINT32
*count
)
354 FIXME("iface %p, count %p stub!\n", iface
, count
);
359 static HRESULT STDMETHODCALLTYPE
d2d_path_geometry_GetFigureCount(ID2D1PathGeometry
*iface
, UINT32
*count
)
361 FIXME("iface %p, count %p stub!\n", iface
, count
);
366 static const struct ID2D1PathGeometryVtbl d2d_path_geometry_vtbl
=
368 d2d_path_geometry_QueryInterface
,
369 d2d_path_geometry_AddRef
,
370 d2d_path_geometry_Release
,
371 d2d_path_geometry_GetFactory
,
372 d2d_path_geometry_GetBounds
,
373 d2d_path_geometry_GetWidenedBounds
,
374 d2d_path_geometry_StrokeContainsPoint
,
375 d2d_path_geometry_FillContainsPoint
,
376 d2d_path_geometry_CompareWithGeometry
,
377 d2d_path_geometry_Simplify
,
378 d2d_path_geometry_Tessellate
,
379 d2d_path_geometry_CombineWithGeometry
,
380 d2d_path_geometry_Outline
,
381 d2d_path_geometry_ComputeArea
,
382 d2d_path_geometry_ComputeLength
,
383 d2d_path_geometry_ComputePointAtLength
,
384 d2d_path_geometry_Widen
,
385 d2d_path_geometry_Open
,
386 d2d_path_geometry_Stream
,
387 d2d_path_geometry_GetSegmentCount
,
388 d2d_path_geometry_GetFigureCount
,
391 void d2d_path_geometry_init(struct d2d_geometry
*geometry
)
393 geometry
->ID2D1Geometry_iface
.lpVtbl
= (ID2D1GeometryVtbl
*)&d2d_path_geometry_vtbl
;
394 geometry
->ID2D1GeometrySink_iface
.lpVtbl
= &d2d_geometry_sink_vtbl
;
395 geometry
->refcount
= 1;