[PATCH 1/5] d2d1: Implement d2d_factory_CreateRectangleGeometry().
Henri Verbeet
hverbeet at codeweavers.com
Tue Jul 14 08:57:39 CDT 2015
---
dlls/d2d1/d2d1_private.h | 29 ++++-
dlls/d2d1/factory.c | 20 ++-
dlls/d2d1/geometry.c | 324 +++++++++++++++++++++++++++++++++++++++++------
3 files changed, 332 insertions(+), 41 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 7519ab4..8ddee9e 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -198,16 +198,39 @@ enum d2d_geometry_state
D2D_GEOMETRY_STATE_FIGURE,
};
+struct d2d_face
+{
+ UINT16 v[3];
+};
+
struct d2d_geometry
{
ID2D1Geometry ID2D1Geometry_iface;
- ID2D1GeometrySink ID2D1GeometrySink_iface;
LONG refcount;
- enum d2d_geometry_state state;
- UINT32 figure_count, segment_count;
+ D2D1_POINT_2F *vertices;
+ size_t vertex_count;
+
+ struct d2d_face *faces;
+ size_t face_count;
+
+ union
+ {
+ struct
+ {
+ ID2D1GeometrySink ID2D1GeometrySink_iface;
+
+ enum d2d_geometry_state state;
+ UINT32 figure_count, segment_count;
+ } path;
+ struct
+ {
+ D2D1_RECT_F rect;
+ } rectangle;
+ } u;
};
void d2d_path_geometry_init(struct d2d_geometry *geometry) DECLSPEC_HIDDEN;
+HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
#endif /* __WINE_D2D1_PRIVATE_H */
diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index 7886d73..b2d5dd0 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -94,9 +94,25 @@ static void STDMETHODCALLTYPE d2d_factory_GetDesktopDpi(ID2D1Factory *iface, flo
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factory *iface,
const D2D1_RECT_F *rect, ID2D1RectangleGeometry **geometry)
{
- FIXME("iface %p, rect %p, geometry %p stub!\n", iface, rect, geometry);
+ struct d2d_geometry *object;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("iface %p, rect %p, geometry %p.\n", iface, rect, geometry);
+
+ if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ if (FAILED(hr = d2d_rectangle_geometry_init(object, rect)))
+ {
+ WARN("Failed to initialize rectangle geometry, hr %#x.\n", hr);
+ HeapFree(GetProcessHeap(), 0, object);
+ return hr;
+ }
+
+ TRACE("Created rectangle geometry %p.\n", object);
+ *geometry = (ID2D1RectangleGeometry *)&object->ID2D1Geometry_iface;
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRoundedRectangleGeometry(ID2D1Factory *iface,
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index 78d3beb..3cd7b91 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -23,9 +23,22 @@
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
+static void d2d_geometry_destroy(struct d2d_geometry *geometry)
+{
+ HeapFree(GetProcessHeap(), 0, geometry->faces);
+ HeapFree(GetProcessHeap(), 0, geometry->vertices);
+ HeapFree(GetProcessHeap(), 0, geometry);
+}
+
+static void d2d_geometry_init(struct d2d_geometry *geometry, const struct ID2D1GeometryVtbl *vtbl)
+{
+ geometry->ID2D1Geometry_iface.lpVtbl = vtbl;
+ geometry->refcount = 1;
+}
+
static inline struct d2d_geometry *impl_from_ID2D1GeometrySink(ID2D1GeometrySink *iface)
{
- return CONTAINING_RECORD(iface, struct d2d_geometry, ID2D1GeometrySink_iface);
+ return CONTAINING_RECORD(iface, struct d2d_geometry, u.path.ID2D1GeometrySink_iface);
}
static HRESULT STDMETHODCALLTYPE d2d_geometry_sink_QueryInterface(ID2D1GeometrySink *iface, REFIID iid, void **out)
@@ -83,14 +96,14 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_BeginFigure(ID2D1GeometrySink *i
FIXME("iface %p, start_point {%.8e, %.8e}, figure_begin %#x stub!\n",
iface, start_point.x, start_point.y, figure_begin);
- if (geometry->state != D2D_GEOMETRY_STATE_OPEN)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_OPEN)
{
- geometry->state = D2D_GEOMETRY_STATE_ERROR;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
return;
}
- geometry->state = D2D_GEOMETRY_STATE_FIGURE;
- ++geometry->figure_count;
- ++geometry->segment_count;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_FIGURE;
+ ++geometry->u.path.figure_count;
+ ++geometry->u.path.segment_count;
}
static void STDMETHODCALLTYPE d2d_geometry_sink_AddLines(ID2D1GeometrySink *iface,
@@ -100,13 +113,13 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_AddLines(ID2D1GeometrySink *ifac
FIXME("iface %p, points %p, count %u stub!\n", iface, points, count);
- if (geometry->state != D2D_GEOMETRY_STATE_FIGURE)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_FIGURE)
{
- geometry->state = D2D_GEOMETRY_STATE_ERROR;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
return;
}
- geometry->segment_count += count;
+ geometry->u.path.segment_count += count;
}
static void STDMETHODCALLTYPE d2d_geometry_sink_AddBeziers(ID2D1GeometrySink *iface,
@@ -116,13 +129,13 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_AddBeziers(ID2D1GeometrySink *if
FIXME("iface %p, beziers %p, count %u stub!\n", iface, beziers, count);
- if (geometry->state != D2D_GEOMETRY_STATE_FIGURE)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_FIGURE)
{
- geometry->state = D2D_GEOMETRY_STATE_ERROR;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
return;
}
- geometry->segment_count += count;
+ geometry->u.path.segment_count += count;
}
static void STDMETHODCALLTYPE d2d_geometry_sink_EndFigure(ID2D1GeometrySink *iface, D2D1_FIGURE_END figure_end)
@@ -131,12 +144,12 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_EndFigure(ID2D1GeometrySink *ifa
FIXME("iface %p, figure_end %#x stub!\n", iface, figure_end);
- if (geometry->state != D2D_GEOMETRY_STATE_FIGURE)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_FIGURE)
{
- geometry->state = D2D_GEOMETRY_STATE_ERROR;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
return;
}
- geometry->state = D2D_GEOMETRY_STATE_OPEN;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_OPEN;
}
static HRESULT STDMETHODCALLTYPE d2d_geometry_sink_Close(ID2D1GeometrySink *iface)
@@ -145,13 +158,13 @@ static HRESULT STDMETHODCALLTYPE d2d_geometry_sink_Close(ID2D1GeometrySink *ifac
TRACE("iface %p.\n", iface);
- if (geometry->state != D2D_GEOMETRY_STATE_OPEN)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_OPEN)
{
- if (geometry->state != D2D_GEOMETRY_STATE_CLOSED)
- geometry->state = D2D_GEOMETRY_STATE_ERROR;
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_CLOSED)
+ geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
return D2DERR_WRONG_STATE;
}
- geometry->state = D2D_GEOMETRY_STATE_CLOSED;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_CLOSED;
return S_OK;
}
@@ -185,13 +198,13 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_AddQuadraticBeziers(ID2D1Geometr
FIXME("iface %p, beziers %p, bezier_count %u stub!\n", iface, beziers, bezier_count);
- if (geometry->state != D2D_GEOMETRY_STATE_FIGURE)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_FIGURE)
{
- geometry->state = D2D_GEOMETRY_STATE_ERROR;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
return;
}
- geometry->segment_count += bezier_count;
+ geometry->u.path.segment_count += bezier_count;
}
static void STDMETHODCALLTYPE d2d_geometry_sink_AddArc(ID2D1GeometrySink *iface, const D2D1_ARC_SEGMENT *arc)
@@ -200,13 +213,13 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_AddArc(ID2D1GeometrySink *iface,
FIXME("iface %p, arc %p stub!\n", iface, arc);
- if (geometry->state != D2D_GEOMETRY_STATE_FIGURE)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_FIGURE)
{
- geometry->state = D2D_GEOMETRY_STATE_ERROR;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
return;
}
- ++geometry->segment_count;
+ ++geometry->u.path.segment_count;
}
struct ID2D1GeometrySinkVtbl d2d_geometry_sink_vtbl =
@@ -271,7 +284,7 @@ static ULONG STDMETHODCALLTYPE d2d_path_geometry_Release(ID2D1PathGeometry *ifac
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
- HeapFree(GetProcessHeap(), 0, geometry);
+ d2d_geometry_destroy(geometry);
return refcount;
}
@@ -406,13 +419,13 @@ static HRESULT STDMETHODCALLTYPE d2d_path_geometry_Open(ID2D1PathGeometry *iface
TRACE("iface %p, sink %p.\n", iface, sink);
- if (geometry->state != D2D_GEOMETRY_STATE_INITIAL)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_INITIAL)
return D2DERR_WRONG_STATE;
- *sink = &geometry->ID2D1GeometrySink_iface;
+ *sink = &geometry->u.path.ID2D1GeometrySink_iface;
ID2D1GeometrySink_AddRef(*sink);
- geometry->state = D2D_GEOMETRY_STATE_OPEN;
+ geometry->u.path.state = D2D_GEOMETRY_STATE_OPEN;
return S_OK;
}
@@ -430,10 +443,10 @@ static HRESULT STDMETHODCALLTYPE d2d_path_geometry_GetSegmentCount(ID2D1PathGeom
TRACE("iface %p, count %p.\n", iface, count);
- if (geometry->state != D2D_GEOMETRY_STATE_CLOSED)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_CLOSED)
return D2DERR_WRONG_STATE;
- *count = geometry->segment_count;
+ *count = geometry->u.path.segment_count;
return S_OK;
}
@@ -444,10 +457,10 @@ static HRESULT STDMETHODCALLTYPE d2d_path_geometry_GetFigureCount(ID2D1PathGeome
TRACE("iface %p, count %p.\n", iface, count);
- if (geometry->state != D2D_GEOMETRY_STATE_CLOSED)
+ if (geometry->u.path.state != D2D_GEOMETRY_STATE_CLOSED)
return D2DERR_WRONG_STATE;
- *count = geometry->figure_count;
+ *count = geometry->u.path.figure_count;
return S_OK;
}
@@ -479,7 +492,246 @@ static const struct ID2D1PathGeometryVtbl d2d_path_geometry_vtbl =
void d2d_path_geometry_init(struct d2d_geometry *geometry)
{
- geometry->ID2D1Geometry_iface.lpVtbl = (ID2D1GeometryVtbl *)&d2d_path_geometry_vtbl;
- geometry->ID2D1GeometrySink_iface.lpVtbl = &d2d_geometry_sink_vtbl;
- geometry->refcount = 1;
+ d2d_geometry_init(geometry, (ID2D1GeometryVtbl *)&d2d_path_geometry_vtbl);
+ geometry->u.path.ID2D1GeometrySink_iface.lpVtbl = &d2d_geometry_sink_vtbl;
+}
+
+static inline struct d2d_geometry *impl_from_ID2D1RectangleGeometry(ID2D1RectangleGeometry *iface)
+{
+ return CONTAINING_RECORD(iface, struct d2d_geometry, ID2D1Geometry_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_QueryInterface(ID2D1RectangleGeometry *iface,
+ REFIID iid, void **out)
+{
+ TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(iid, &IID_ID2D1RectangleGeometry)
+ || IsEqualGUID(iid, &IID_ID2D1Geometry)
+ || IsEqualGUID(iid, &IID_ID2D1Resource)
+ || IsEqualGUID(iid, &IID_IUnknown))
+ {
+ ID2D1RectangleGeometry_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_rectangle_geometry_AddRef(ID2D1RectangleGeometry *iface)
+{
+ struct d2d_geometry *geometry = impl_from_ID2D1RectangleGeometry(iface);
+ ULONG refcount = InterlockedIncrement(&geometry->refcount);
+
+ TRACE("%p increasing refcount to %u.\n", iface, refcount);
+
+ return refcount;
+}
+
+static ULONG STDMETHODCALLTYPE d2d_rectangle_geometry_Release(ID2D1RectangleGeometry *iface)
+{
+ struct d2d_geometry *geometry = impl_from_ID2D1RectangleGeometry(iface);
+ ULONG refcount = InterlockedDecrement(&geometry->refcount);
+
+ TRACE("%p decreasing refcount to %u.\n", iface, refcount);
+
+ if (!refcount)
+ d2d_geometry_destroy(geometry);
+
+ return refcount;
+}
+
+static void STDMETHODCALLTYPE d2d_rectangle_geometry_GetFactory(ID2D1RectangleGeometry *iface, ID2D1Factory **factory)
+{
+ FIXME("iface %p, factory %p stub!\n", iface, factory);
+
+ *factory = NULL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_GetBounds(ID2D1RectangleGeometry *iface,
+ const D2D1_MATRIX_3X2_F *transform, D2D1_RECT_F *bounds)
+{
+ FIXME("iface %p, transform %p, bounds %p stub!\n", iface, transform, bounds);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_GetWidenedBounds(ID2D1RectangleGeometry *iface,
+ float stroke_width, ID2D1StrokeStyle *stroke_style, const D2D1_MATRIX_3X2_F *transform,
+ float tolerance, D2D1_RECT_F *bounds)
+{
+ FIXME("iface %p, stroke_width %.8e, stroke_style %p, transform %p, tolerance %.8e, bounds %p stub!\n",
+ iface, stroke_width, stroke_style, transform, tolerance, bounds);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_StrokeContainsPoint(ID2D1RectangleGeometry *iface,
+ D2D1_POINT_2F point, float stroke_width, ID2D1StrokeStyle *stroke_style, const D2D1_MATRIX_3X2_F *transform,
+ float tolerance, BOOL *contains)
+{
+ FIXME("iface %p, point {%.8e, %.8e}, stroke_width %.8e, stroke_style %p, "
+ "transform %p, tolerance %.8e, contains %p stub!\n",
+ iface, point.x, point.y, stroke_width, stroke_style, transform, tolerance, contains);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_FillContainsPoint(ID2D1RectangleGeometry *iface,
+ D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F *transform, float tolerance, BOOL *contains)
+{
+ FIXME("iface %p, point {%.8e, %.8e}, transform %p, tolerance %.8e, contains %p stub!\n",
+ iface, point.x, point.y, transform, tolerance, contains);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_CompareWithGeometry(ID2D1RectangleGeometry *iface,
+ ID2D1Geometry *geometry, const D2D1_MATRIX_3X2_F *transform, float tolerance, D2D1_GEOMETRY_RELATION *relation)
+{
+ FIXME("iface %p, geometry %p, transform %p, tolerance %.8e, relation %p stub!\n",
+ iface, geometry, transform, tolerance, relation);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_Simplify(ID2D1RectangleGeometry *iface,
+ D2D1_GEOMETRY_SIMPLIFICATION_OPTION option, const D2D1_MATRIX_3X2_F *transform, float tolerance,
+ ID2D1SimplifiedGeometrySink *sink)
+{
+ FIXME("iface %p, option %#x, transform %p, tolerance %.8e, sink %p stub!\n",
+ iface, option, transform, tolerance, sink);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_Tessellate(ID2D1RectangleGeometry *iface,
+ const D2D1_MATRIX_3X2_F *transform, float tolerance, ID2D1TessellationSink *sink)
+{
+ FIXME("iface %p, transform %p, tolerance %.8e, sink %p stub!\n", iface, transform, tolerance, sink);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_CombineWithGeometry(ID2D1RectangleGeometry *iface,
+ ID2D1Geometry *geometry, D2D1_COMBINE_MODE combine_mode, const D2D1_MATRIX_3X2_F *transform,
+ float tolerance, ID2D1SimplifiedGeometrySink *sink)
+{
+ FIXME("iface %p, geometry %p, combine_mode %#x, transform %p, tolerance %.8e, sink %p stub!\n",
+ iface, geometry, combine_mode, transform, tolerance, sink);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_Outline(ID2D1RectangleGeometry *iface,
+ const D2D1_MATRIX_3X2_F *transform, float tolerance, ID2D1SimplifiedGeometrySink *sink)
+{
+ FIXME("iface %p, transform %p, tolerance %.8e, sink %p stub!\n", iface, transform, tolerance, sink);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_ComputeArea(ID2D1RectangleGeometry *iface,
+ const D2D1_MATRIX_3X2_F *transform, float tolerance, float *area)
+{
+ FIXME("iface %p, transform %p, tolerance %.8e, area %p stub!\n", iface, transform, tolerance, area);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_ComputeLength(ID2D1RectangleGeometry *iface,
+ const D2D1_MATRIX_3X2_F *transform, float tolerance, float *length)
+{
+ FIXME("iface %p, transform %p, tolerance %.8e, length %p stub!\n", iface, transform, tolerance, length);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_ComputePointAtLength(ID2D1RectangleGeometry *iface,
+ float length, const D2D1_MATRIX_3X2_F *transform, float tolerance, D2D1_POINT_2F *point,
+ D2D1_POINT_2F *tangent)
+{
+ FIXME("iface %p, length %.8e, transform %p, tolerance %.8e, point %p, tangent %p stub!\n",
+ iface, length, transform, tolerance, point, tangent);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_Widen(ID2D1RectangleGeometry *iface, float stroke_width,
+ ID2D1StrokeStyle *stroke_style, const D2D1_MATRIX_3X2_F *transform, float tolerance,
+ ID2D1SimplifiedGeometrySink *sink)
+{
+ FIXME("iface %p, stroke_width %.8e, stroke_style %p, transform %p, tolerance %.8e, sink %p stub!\n",
+ iface, stroke_width, stroke_style, transform, tolerance, sink);
+
+ return E_NOTIMPL;
+}
+
+static void STDMETHODCALLTYPE d2d_rectangle_geometry_GetRect(ID2D1RectangleGeometry *iface, D2D1_RECT_F *rect)
+{
+ struct d2d_geometry *geometry = impl_from_ID2D1RectangleGeometry(iface);
+
+ TRACE("iface %p, rect %p.\n", iface, rect);
+
+ *rect = geometry->u.rectangle.rect;
+}
+
+static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl =
+{
+ d2d_rectangle_geometry_QueryInterface,
+ d2d_rectangle_geometry_AddRef,
+ d2d_rectangle_geometry_Release,
+ d2d_rectangle_geometry_GetFactory,
+ d2d_rectangle_geometry_GetBounds,
+ d2d_rectangle_geometry_GetWidenedBounds,
+ d2d_rectangle_geometry_StrokeContainsPoint,
+ d2d_rectangle_geometry_FillContainsPoint,
+ d2d_rectangle_geometry_CompareWithGeometry,
+ d2d_rectangle_geometry_Simplify,
+ d2d_rectangle_geometry_Tessellate,
+ d2d_rectangle_geometry_CombineWithGeometry,
+ d2d_rectangle_geometry_Outline,
+ d2d_rectangle_geometry_ComputeArea,
+ d2d_rectangle_geometry_ComputeLength,
+ d2d_rectangle_geometry_ComputePointAtLength,
+ d2d_rectangle_geometry_Widen,
+ d2d_rectangle_geometry_GetRect,
+};
+
+HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, const D2D1_RECT_F *rect)
+{
+ d2d_geometry_init(geometry, (ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl);
+ geometry->u.rectangle.rect = *rect;
+
+ if (!(geometry->vertices = HeapAlloc(GetProcessHeap(), 0, 4 * sizeof(*geometry->vertices))))
+ return E_OUTOFMEMORY;
+ geometry->vertex_count = 4;
+ if (!(geometry->faces = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(*geometry->faces))))
+ {
+ HeapFree(GetProcessHeap(), 0, geometry->vertices);
+ return E_OUTOFMEMORY;
+ }
+ geometry->face_count = 2;
+
+ geometry->vertices[0].x = min(rect->left, rect->right);
+ geometry->vertices[0].y = min(rect->top, rect->bottom);
+ geometry->vertices[1].x = min(rect->left, rect->right);
+ geometry->vertices[1].y = max(rect->top, rect->bottom);
+ geometry->vertices[2].x = max(rect->left, rect->right);
+ geometry->vertices[2].y = min(rect->top, rect->bottom);
+ geometry->vertices[3].x = max(rect->left, rect->right);
+ geometry->vertices[3].y = max(rect->top, rect->bottom);
+
+ geometry->faces[0].v[0] = 0;
+ geometry->faces[0].v[1] = 2;
+ geometry->faces[0].v[2] = 1;
+ geometry->faces[1].v[0] = 1;
+ geometry->faces[1].v[1] = 2;
+ geometry->faces[1].v[2] = 3;
+
+ return S_OK;
}
--
2.1.4
More information about the wine-patches
mailing list