From edd2bb7370790ba7e5fac81629d9f2a7a36eb5e8 Mon Sep 17 00:00:00 2001
From: Ken Thomases <ken@codeweavers.com>
Date: Wed, 19 Mar 2014 15:48:02 -0500
Subject: wined3d: Pass the context, not its window, into
 surface_translate_drawable_coords().
To: wine-patches <wine-patches@winehq.org>

---
 dlls/wined3d/arb_program_shader.c |    2 +-
 dlls/wined3d/surface.c            |   12 ++++++------
 dlls/wined3d/wined3d_private.h    |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 1eab0eb..5b12b55 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7679,7 +7679,7 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
     context_apply_blit_state(context, device);
 
     if (!surface_is_offscreen(dst_surface))
-        surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
+        surface_translate_drawable_coords(dst_surface, context, &dst_rect);
 
     arbfp_blit_set(device->blit_priv, context, src_surface);
 
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 7c5f053..cdc157e 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1024,7 +1024,7 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te
     {
         TRACE("Source surface %p is onscreen.\n", src_surface);
         buffer = surface_get_gl_buffer(src_surface);
-        surface_translate_drawable_coords(src_surface, context->win_handle, &src_rect);
+        surface_translate_drawable_coords(src_surface, context, &src_rect);
     }
     else
     {
@@ -1041,7 +1041,7 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te
     {
         TRACE("Destination surface %p is onscreen.\n", dst_surface);
         buffer = surface_get_gl_buffer(dst_surface);
-        surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
+        surface_translate_drawable_coords(dst_surface, context, &dst_rect);
     }
     else
     {
@@ -4262,7 +4262,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
  * drawable is limited to the window's client area. The sysmem and texture
  * copies do have the full screen size. Note that GL has a bottom-left
  * origin, while D3D has a top-left origin. */
-void surface_translate_drawable_coords(const struct wined3d_surface *surface, HWND window, RECT *rect)
+void surface_translate_drawable_coords(const struct wined3d_surface *surface, const struct wined3d_context *context, RECT *rect)
 {
     UINT drawable_height;
 
@@ -4271,10 +4271,10 @@ void surface_translate_drawable_coords(const struct wined3d_surface *surface, HW
         POINT offset = {0, 0};
         RECT windowsize;
 
-        ScreenToClient(window, &offset);
+        ScreenToClient(context->win_handle, &offset);
         OffsetRect(rect, offset.x, offset.y);
 
-        GetClientRect(window, &windowsize);
+        GetClientRect(context->win_handle, &windowsize);
         drawable_height = windowsize.bottom - windowsize.top;
     }
     else
@@ -4310,7 +4310,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
     context_apply_blit_state(context, device);
 
     if (!surface_is_offscreen(dst_surface))
-        surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
+        surface_translate_drawable_coords(dst_surface, context, &dst_rect);
 
     device->blitter->set_shader(device->blit_priv, context, src_surface);
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7abcc8a..dab0724 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2276,7 +2276,7 @@ void surface_set_compatible_renderbuffer(struct wined3d_surface *surface,
 void surface_set_container(struct wined3d_surface *surface, struct wined3d_texture *container) DECLSPEC_HIDDEN;
 void surface_set_swapchain(struct wined3d_surface *surface, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
 void surface_set_texture_target(struct wined3d_surface *surface, GLenum target, GLint level) DECLSPEC_HIDDEN;
-void surface_translate_drawable_coords(const struct wined3d_surface *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
+void surface_translate_drawable_coords(const struct wined3d_surface *surface, const struct wined3d_context *context, RECT *rect) DECLSPEC_HIDDEN;
 void surface_update_draw_binding(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
         struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
-- 
1.7.7.4

