wined3d: Simply pass an IWineD3DSurfaceImpl pointer to surface_get_gl_buffer().
authorHenri Verbeet <hverbeet@codeweavers.com>
Tue, 20 Apr 2010 20:38:42 +0000 (22:38 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 21 Apr 2010 09:57:32 +0000 (11:57 +0200)
dlls/wined3d/context.c
dlls/wined3d/device.c
dlls/wined3d/surface.c
dlls/wined3d/wined3d_private.h

index 716ec559da4c4736a490a9564436016f967b30b6..7aae16d6c55c78d0bb4a61ec46149fca01cf4e27 100644 (file)
@@ -1874,11 +1874,11 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur
 static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
-    IWineD3DSurface *rt = context->current_rt;
+    IWineD3DSurfaceImpl *rt = (IWineD3DSurfaceImpl *)context->current_rt;
     IWineD3DDeviceImpl *device;
 
-    device = ((IWineD3DSurfaceImpl *)rt)->resource.device;
-    if (!surface_is_offscreen((IWineD3DSurfaceImpl *)rt))
+    device = rt->resource.device;
+    if (!surface_is_offscreen(rt))
     {
         ENTER_GL();
         glDrawBuffer(surface_get_gl_buffer(rt));
index 52d82b21143b776cce4763d154c1d606a8dc9747..ff4a9b458327e4ea904333da9c9d3716d488f66e 100644 (file)
@@ -4403,7 +4403,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
 
             ENTER_GL();
             context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
-            context_set_draw_buffer(context, surface_get_gl_buffer((IWineD3DSurface *)target));
+            context_set_draw_buffer(context, surface_get_gl_buffer(target));
             LEAVE_GL();
         }
         else
@@ -5465,7 +5465,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
         context = context_acquire(This, surface, CTXUSAGE_RESOURCELOAD);
         ENTER_GL();
         context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
-        context_set_draw_buffer(context, surface_get_gl_buffer(surface));
+        context_set_draw_buffer(context, surface_get_gl_buffer((IWineD3DSurfaceImpl *)surface));
     }
     else
     {
@@ -5773,7 +5773,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const
 
     if (!surface_is_offscreen((IWineD3DSurfaceImpl *)src_surface))
     {
-        GLenum buffer = surface_get_gl_buffer(src_surface);
+        GLenum buffer = surface_get_gl_buffer((IWineD3DSurfaceImpl *)src_surface);
 
         TRACE("Source surface %p is onscreen\n", src_surface);
 
@@ -5809,7 +5809,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const
     /* Attach dst surface to dst fbo */
     if (!surface_is_offscreen((IWineD3DSurfaceImpl *)dst_surface))
     {
-        GLenum buffer = surface_get_gl_buffer(dst_surface);
+        GLenum buffer = surface_get_gl_buffer((IWineD3DSurfaceImpl *)dst_surface);
 
         TRACE("Destination surface %p is onscreen\n", dst_surface);
 
index 91baf9c3d994332c29c67df5ee9763c3ef7da843..46261fc27e7d65ed95db1273276ea40e94c4d82d 100644 (file)
@@ -925,20 +925,19 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned
     checkGLcall("set_compatible_renderbuffer");
 }
 
-GLenum surface_get_gl_buffer(IWineD3DSurface *iface)
+GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface)
 {
-    IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
-    IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)This->container;
+    IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)surface->container;
 
-    TRACE("iface %p.\n", iface);
+    TRACE("surface %p.\n", surface);
 
-    if (!(This->Flags & SFLAG_SWAPCHAIN))
+    if (!(surface->Flags & SFLAG_SWAPCHAIN))
     {
-        ERR("Surface %p is not on a swapchain.\n", iface);
+        ERR("Surface %p is not on a swapchain.\n", surface);
         return GL_NONE;
     }
 
-    if (swapchain->backBuffer && swapchain->backBuffer[0] == iface)
+    if (swapchain->backBuffer && (IWineD3DSurfaceImpl *)swapchain->backBuffer[0] == surface)
     {
         if (swapchain->render_to_fbo)
         {
@@ -948,7 +947,7 @@ GLenum surface_get_gl_buffer(IWineD3DSurface *iface)
         TRACE("Returning GL_BACK\n");
         return GL_BACK;
     }
-    else if (swapchain->frontBuffer == iface)
+    else if ((IWineD3DSurfaceImpl *)swapchain->frontBuffer == surface)
     {
         TRACE("Returning GL_FRONT\n");
         return GL_FRONT;
@@ -1294,7 +1293,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
     else
     {
         /* Onscreen surfaces are always part of a swapchain */
-        GLenum buffer = surface_get_gl_buffer((IWineD3DSurface *)This);
+        GLenum buffer = surface_get_gl_buffer(This);
         TRACE("Locking %#x buffer\n", buffer);
         glReadBuffer(buffer);
         checkGLcall("glReadBuffer");
@@ -1516,7 +1515,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
      */
     if (!surface_is_offscreen(This))
     {
-        GLenum buffer = surface_get_gl_buffer((IWineD3DSurface *)This);
+        GLenum buffer = surface_get_gl_buffer(This);
         TRACE("Locking %#x buffer\n", buffer);
 
         ENTER_GL();
@@ -1775,7 +1774,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
 
     if (!surface_is_offscreen(This))
     {
-        GLenum buffer = surface_get_gl_buffer((IWineD3DSurface *)This);
+        GLenum buffer = surface_get_gl_buffer(This);
         TRACE("Unlocking %#x buffer.\n", buffer);
         context_set_draw_buffer(context, buffer);
     }
@@ -2999,7 +2998,7 @@ static inline void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3D
     }
     else
     {
-        glReadBuffer(surface_get_gl_buffer(SrcSurface));
+        glReadBuffer(surface_get_gl_buffer(Src));
     }
     checkGLcall("glReadBuffer");
 
@@ -3154,7 +3153,7 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
     }
     else
     {
-        glReadBuffer(surface_get_gl_buffer(SrcSurface));
+        glReadBuffer(surface_get_gl_buffer(Src));
     }
 
     /* TODO: Only back up the part that will be overwritten */
index 260e3c72b0ae1090236d503c8a3c2263a153c093..0dfe082e4e7882f377443c8c269688f9fb4d172b 100644 (file)
@@ -2679,7 +2679,7 @@ void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock,
         struct wined3d_context *context) DECLSPEC_HIDDEN;
 
 void surface_add_dirty_rect(IWineD3DSurface *iface, const RECT *dirty_rect) DECLSPEC_HIDDEN;
-GLenum surface_get_gl_buffer(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
+GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
 void surface_load_ds_location(IWineD3DSurfaceImpl *surface,
         struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
 void surface_modify_ds_location(IWineD3DSurfaceImpl *surface, DWORD location) DECLSPEC_HIDDEN;