From 74735f327c804b8739489bbcb777736516c33f03 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 8 Dec 2016 14:32:00 +0100 Subject: [PATCH] d2d1: Use d2d_point_set() in d2d_rectangle_geometry_init(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d2d1/d2d1_private.h | 6 ++++++ dlls/d2d1/geometry.c | 21 +++++++++++++-------- dlls/d2d1/render_target.c | 6 ------ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 2e05b8036c..5b494d507a 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -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; diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c index 8bdd818679..f0e1d085cc 100644 --- a/dlls/d2d1/geometry.c +++ b/dlls/d2d1/geometry.c @@ -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; diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c index 74dbfb75d0..0a70897c22 100644 --- a/dlls/d2d1/render_target.c +++ b/dlls/d2d1/render_target.c @@ -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)