d2d1: Use d2d_point_set() in d2d_rectangle_geometry_init().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-12-08 14:32:00 +01:00 committed by Alexandre Julliard
parent 91baf67e4a
commit 74735f327c
3 changed files with 19 additions and 14 deletions

View File

@ -382,6 +382,12 @@ static inline BOOL d2d_matrix_invert(D2D_MATRIX_3X2_F *dst, const D2D_MATRIX_3X2
return TRUE;
}
static inline void d2d_point_set(D2D1_POINT_2F *dst, float x, float y)
{
dst->x = x;
dst->y = y;
}
static inline void d2d_point_transform(D2D1_POINT_2F *dst, const D2D1_MATRIX_3X2_F *matrix, float x, float y)
{
dst->x = x * matrix->_11 + y * matrix->_21 + matrix->_31;

View File

@ -2600,6 +2600,9 @@ static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl =
HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory, const D2D1_RECT_F *rect)
{
D2D1_POINT_2F *fv;
float l, r, t, b;
d2d_geometry_init(geometry, factory, &identity, (ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl);
geometry->u.rectangle.rect = *rect;
@ -2617,14 +2620,16 @@ HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory
}
geometry->fill.face_count = 2;
geometry->fill.vertices[0].x = min(rect->left, rect->right);
geometry->fill.vertices[0].y = min(rect->top, rect->bottom);
geometry->fill.vertices[1].x = min(rect->left, rect->right);
geometry->fill.vertices[1].y = max(rect->top, rect->bottom);
geometry->fill.vertices[2].x = max(rect->left, rect->right);
geometry->fill.vertices[2].y = min(rect->top, rect->bottom);
geometry->fill.vertices[3].x = max(rect->left, rect->right);
geometry->fill.vertices[3].y = max(rect->top, rect->bottom);
l = min(rect->left, rect->right);
r = max(rect->left, rect->right);
t = min(rect->top, rect->bottom);
b = max(rect->top, rect->bottom);
fv = geometry->fill.vertices;
d2d_point_set(&fv[0], l, t);
d2d_point_set(&fv[1], l, b);
d2d_point_set(&fv[2], r, t);
d2d_point_set(&fv[3], r, b);
geometry->fill.faces[0].v[0] = 0;
geometry->fill.faces[0].v[1] = 2;

View File

@ -42,12 +42,6 @@ static ID2D1Brush *d2d_draw_get_text_brush(struct d2d_draw_text_layout_ctx *cont
return context->brush;
}
static void d2d_point_set(D2D1_POINT_2F *dst, float x, float y)
{
dst->x = x;
dst->y = y;
}
static void d2d_rect_expand(D2D1_RECT_F *dst, const D2D1_POINT_2F *point)
{
if (point->x < dst->left)