Module: wine Branch: master Commit: b3790bf8033e7f1ec507288fac2a2290e4053442 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3790bf8033e7f1ec507288fac...
Author: Michael Stefaniuc mstefani@redhat.de Date: Tue Mar 8 11:52:22 2016 +0100
wined3d: Use SetRect() instead of open coding it.
Signed-off-by: Michael Stefaniuc mstefani@redhat.de Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wined3d/device.c | 16 ++++------------ dlls/wined3d/surface.c | 5 +---- dlls/wined3d/swapchain.c | 6 ++---- dlls/wined3d/texture.c | 5 +---- 4 files changed, 8 insertions(+), 24 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f094752..ff16c9d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3975,23 +3975,15 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev return WINED3DERR_INVALIDCALL; }
- src_rect.left = src_box->left; - src_rect.top = src_box->top; - src_rect.right = src_box->right; - src_rect.bottom = src_box->bottom; + SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); } else { - src_rect.left = 0; - src_rect.top = 0; - src_rect.right = src_surface->resource.width; - src_rect.bottom = src_surface->resource.height; + SetRect(&src_rect, 0, 0, src_surface->resource.width, src_surface->resource.height); }
- dst_rect.left = dst_x; - dst_rect.top = dst_y; - dst_rect.right = dst_x + (src_rect.right - src_rect.left); - dst_rect.bottom = dst_y + (src_rect.bottom - src_rect.top); + SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), + dst_y + (src_rect.bottom - src_rect.top));
if (FAILED(hr = wined3d_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) WARN("Failed to blit, hr %#x.\n", hr); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 814d4ab..c7545e0 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1444,10 +1444,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
if (!src_rect) { - r.left = 0; - r.top = 0; - r.right = src_surface->resource.width; - r.bottom = src_surface->resource.height; + SetRect(&r, 0, 0, src_surface->resource.width, src_surface->resource.height); src_rect = &r; } else if (src_rect->left < 0 || src_rect->left >= src_rect->right diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 299a47a..9f3a36b 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -545,10 +545,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT } else { - src_rect.left = 0; - src_rect.top = 0; - src_rect.right = swapchain->desc.backbuffer_width; - src_rect.bottom = swapchain->desc.backbuffer_height; + SetRect(&src_rect, 0, 0, swapchain->desc.backbuffer_width, + swapchain->desc.backbuffer_height); }
if (dst_rect_in) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 71ce472..3ac6f43 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -880,10 +880,7 @@ static void texture2d_sub_resource_upload_data(struct wined3d_resource *sub_reso struct wined3d_const_bo_address addr; RECT src_rect;
- src_rect.left = 0; - src_rect.top = 0; - src_rect.right = surface->resource.width; - src_rect.bottom = surface->resource.height; + SetRect(&src_rect, 0, 0, surface->resource.width, surface->resource.height);
addr.buffer_object = 0; addr.addr = data->data;