Henri Verbeet : wined3d: Pass an IWineD3DSwapChainImpl pointer to findThreadContextForSwapChain().

Alexandre Julliard julliard at winehq.org
Wed Jan 19 11:46:09 CST 2011


Module: wine
Branch: master
Commit: f250ee66a38f9b00f179ac98e697599b77217487
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f250ee66a38f9b00f179ac98e697599b77217487

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Jan 18 17:55:22 2011 +0100

wined3d: Pass an IWineD3DSwapChainImpl pointer to findThreadContextForSwapChain().

---

 dlls/wined3d/context.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index bd63f9a..2265188 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1866,19 +1866,18 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte
  * If none can be found the swapchain is requested to create a new context
  *
  *****************************************************************************/
-static struct wined3d_context *findThreadContextForSwapChain(IWineD3DSwapChain *swapchain, DWORD tid)
+static struct wined3d_context *findThreadContextForSwapChain(struct IWineD3DSwapChainImpl *swapchain, DWORD tid)
 {
     unsigned int i;
 
-    for(i = 0; i < ((IWineD3DSwapChainImpl *) swapchain)->num_contexts; i++) {
-        if(((IWineD3DSwapChainImpl *) swapchain)->context[i]->tid == tid) {
-            return ((IWineD3DSwapChainImpl *) swapchain)->context[i];
-        }
-
+    for (i = 0; i < swapchain->num_contexts; ++i)
+    {
+        if (swapchain->context[i]->tid == tid)
+            return swapchain->context[i];
     }
 
     /* Create a new context for the thread */
-    return swapchain_create_context_for_thread((IWineD3DSwapChainImpl *)swapchain);
+    return swapchain_create_context_for_thread(swapchain);
 }
 
 /* Do not call while under the GL lock. */
@@ -1914,12 +1913,9 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur
 
     if (target->container.type == WINED3D_CONTAINER_SWAPCHAIN)
     {
-        IWineD3DSwapChain *swapchain;
-
         TRACE("Rendering onscreen\n");
 
-        swapchain = (IWineD3DSwapChain *)target->container.u.swapchain;
-        context = findThreadContextForSwapChain(swapchain, tid);
+        context = findThreadContextForSwapChain(target->container.u.swapchain, tid);
     }
     else
     {
@@ -1938,7 +1934,7 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur
              *
              * Can also happen on thread switches - in that case findThreadContextForSwapChain
              * is perfect to call. */
-            context = findThreadContextForSwapChain(This->swapchains[0], tid);
+            context = findThreadContextForSwapChain((IWineD3DSwapChainImpl *)This->swapchains[0], tid);
         }
     }
 




More information about the wine-cvs mailing list