wined3d: Correctly translate between coordinate systems in swapchain_blit().
authorHenri Verbeet <hverbeet@codeweavers.com>
Tue, 18 May 2010 07:53:09 +0000 (09:53 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 18 May 2010 16:42:09 +0000 (18:42 +0200)
dlls/wined3d/swapchain.c

index eeb12786b0e6a4d8d92a79363dbd1e491f1893aa..7dca2532dd71a0727912d04270b6666fd38ba448 100644 (file)
@@ -105,6 +105,8 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
     UINT src_h = src_rect->bottom - src_rect->top;
     GLenum gl_filter;
     const struct wined3d_gl_info *gl_info = context->gl_info;
+    RECT win_rect;
+    UINT win_h;
 
     TRACE("swapchain %p, context %p, src_rect %s, dst_rect %s.\n",
             This, context, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect));
@@ -114,6 +116,9 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
     else
         gl_filter = GL_LINEAR;
 
+    GetClientRect(This->win_handle, &win_rect);
+    win_h = win_rect.bottom - win_rect.top;
+
     if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format_desc->color_fixup))
     {
         ENTER_GL();
@@ -128,8 +133,8 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
 
         /* Note that the texture is upside down */
         gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom,
-                                           dst_rect->left, dst_rect->bottom, dst_rect->right, dst_rect->top,
-                                           GL_COLOR_BUFFER_BIT, gl_filter);
+                dst_rect->left, win_h - dst_rect->top, dst_rect->right, win_h - dst_rect->bottom,
+                GL_COLOR_BUFFER_BIT, gl_filter);
         checkGLcall("Swapchain present blit(EXT_framebuffer_blit)\n");
         LEAVE_GL();
     }
@@ -176,7 +181,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
          * Note that context_apply_blit_state() set up viewport and ortho to
          * match the surface size - we want the GL drawable(=window) size. */
         glPushAttrib(GL_VIEWPORT_BIT);
-        glViewport(dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom);
+        glViewport(dst_rect->left, win_h - dst_rect->bottom, dst_rect->right, win_h - dst_rect->top);
         glMatrixMode(GL_PROJECTION);
         glPushMatrix();
         glLoadIdentity();