Hadrien Boizard : winemac.drv: Use EqualRect() instead of memcmp() to compare RECTs.
Alexandre Julliard
julliard at winehq.org
Tue Oct 4 13:38:26 CDT 2016
Module: wine
Branch: master
Commit: 5d96ef42a58e09a2d6cf47a685abb3f42b513ceb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5d96ef42a58e09a2d6cf47a685abb3f42b513ceb
Author: Hadrien Boizard <h.boizard at gmail.com>
Date: Wed Sep 28 23:53:32 2016 +0200
winemac.drv: Use EqualRect() instead of memcmp() to compare RECTs.
Signed-off-by: Hadrien Boizard <h.boizard at gmail.com>
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winemac.drv/opengl.c | 4 ++--
dlls/winemac.drv/window.c | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index e1953dd..6e1f151 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -1652,7 +1652,7 @@ static BOOL sync_context_rect(struct wgl_context *context)
{
RECT rect = data->client_rect;
OffsetRect(&rect, -data->whole_rect.left, -data->whole_rect.top);
- if (memcmp(&context->draw_rect, &rect, sizeof(context->draw_rect)))
+ if (!EqualRect(&context->draw_rect, &rect))
{
context->draw_rect = rect;
ret = TRUE;
@@ -4327,7 +4327,7 @@ void sync_gl_view(struct macdrv_win_data* data, const RECT* old_whole_rect, cons
OffsetRect(&old, -old_whole_rect->left, -old_whole_rect->top);
OffsetRect(&new, -data->whole_rect.left, -data->whole_rect.top);
- if (memcmp(&old, &new, sizeof(old)))
+ if (!EqualRect(&old, &new))
{
TRACE("GL view %p changed position; marking contexts\n", data->client_cocoa_view);
mark_contexts_for_moved_view(data->client_cocoa_view);
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
index f4be7ce..0359ef7 100644
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -746,7 +746,7 @@ static void destroy_cocoa_window(struct macdrv_win_data *data)
*/
static void create_cocoa_view(struct macdrv_win_data *data)
{
- BOOL equal = !memcmp(&data->window_rect, &data->client_rect, sizeof(data->whole_rect));
+ BOOL equal = EqualRect(&data->window_rect, &data->client_rect);
CGRect frame = cgrect_from_rect(data->window_rect);
data->shaped = FALSE;
@@ -1055,7 +1055,7 @@ static void sync_window_position(struct macdrv_win_data *data, UINT swp_flags, c
else
{
BOOL were_equal = (data->cocoa_view == data->client_cocoa_view);
- BOOL now_equal = !memcmp(&data->whole_rect, &data->client_rect, sizeof(data->whole_rect));
+ BOOL now_equal = EqualRect(&data->whole_rect, &data->client_rect);
if (were_equal && !now_equal)
{
@@ -1781,7 +1781,7 @@ BOOL CDECL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *
OffsetRect(&rect, -window_rect->left, -window_rect->top);
surface = data->surface;
- if (!surface || memcmp(&surface->rect, &rect, sizeof(RECT)))
+ if (!surface || !EqualRect(&surface->rect, &rect))
{
data->surface = create_surface(data->cocoa_window, &rect, NULL, TRUE);
set_window_surface(data->cocoa_window, data->surface);
@@ -1967,7 +1967,7 @@ void CDECL macdrv_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags
surface_rect = get_surface_rect(visible_rect);
if (data->surface)
{
- if (!memcmp(&data->surface->rect, &surface_rect, sizeof(surface_rect)))
+ if (EqualRect(&data->surface->rect, &surface_rect))
{
/* existing surface is good enough */
surface_clip_to_visible_rect(data->surface, visible_rect);
@@ -2051,7 +2051,7 @@ void CDECL macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
old_client_rect.right - data->client_rect.right == x_offset &&
old_client_rect.top - data->client_rect.top == y_offset &&
old_client_rect.bottom - data->client_rect.bottom == y_offset &&
- !memcmp(&valid_rects[0], &data->client_rect, sizeof(RECT)))
+ EqualRect(&valid_rects[0], &data->client_rect))
{
/* A Cocoa window's bits are moved automatically */
if (!window && (x_offset != 0 || y_offset != 0))
More information about the wine-cvs
mailing list