[PATCH] wined3d: Store the cursor texture in a local variable in swapchain_gl_present().

Zebediah Figura zfigura at codeweavers.com
Mon Jun 24 19:08:36 CDT 2019


From: Zebediah Figura <z.figura12 at gmail.com>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47392
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/wined3d/swapchain.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 8d6306eee66..b75aead1e83 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -428,9 +428,9 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
     struct wined3d_texture *back_buffer = swapchain->back_buffers[0];
     const struct wined3d_fb_state *fb = &swapchain->device->cs->fb;
     struct wined3d_rendertarget_view *dsv = fb->depth_stencil;
+    struct wined3d_texture *logo_texture, *cursor_texture;
     const struct wined3d_gl_info *gl_info;
     struct wined3d_context_gl *context_gl;
-    struct wined3d_texture *logo_texture;
     struct wined3d_context *context;
     BOOL render_to_fbo;
 
@@ -456,8 +456,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
                 WINED3D_BLT_SRC_CKEY, NULL, WINED3D_TEXF_POINT);
     }
 
-    if (swapchain->device->bCursorVisible && swapchain->device->cursor_texture
-            && !swapchain->device->hardwareCursor)
+    if ((cursor_texture = swapchain->device->cursor_texture)
+            && swapchain->device->bCursorVisible && !swapchain->device->hardwareCursor)
     {
         RECT dst_rect =
         {
@@ -468,9 +468,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
         };
         RECT src_rect =
         {
-            0, 0,
-            swapchain->device->cursor_texture->resource.width,
-            swapchain->device->cursor_texture->resource.height
+            0, 0, cursor_texture->resource.width, cursor_texture->resource.height
         };
         const RECT clip_rect = {0, 0, back_buffer->resource.width, back_buffer->resource.height};
 
@@ -479,9 +477,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
         if (swapchain->desc.windowed)
             MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&dst_rect, 2);
         if (wined3d_clip_blit(&clip_rect, &dst_rect, &src_rect))
-            wined3d_texture_blt(back_buffer, 0, &dst_rect,
-                    swapchain->device->cursor_texture, 0, &src_rect,
-                    WINED3D_BLT_ALPHA_TEST, NULL, WINED3D_TEXF_POINT);
+            wined3d_texture_blt(back_buffer, 0, &dst_rect, cursor_texture, 0,
+                    &src_rect, WINED3D_BLT_ALPHA_TEST, NULL, WINED3D_TEXF_POINT);
     }
 
     TRACE("Presenting DC %p.\n", context_gl->dc);
-- 
2.20.1




More information about the wine-devel mailing list