[PATCH 5/5] wined3d: Simply pass an IWineD3DSurfaceImpl pointer to surface_add_dirty_rect().

Henri Verbeet hverbeet at codeweavers.com
Mon Apr 26 14:33:04 CDT 2010


---
 dlls/wined3d/cubetexture.c     |    4 ++--
 dlls/wined3d/surface.c         |   38 +++++++++++++++++++-------------------
 dlls/wined3d/texture.c         |    4 ++--
 dlls/wined3d/wined3d_private.h |    2 +-
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index c11e32b..23b4554 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -396,12 +396,12 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *
         WINED3DCUBEMAP_FACES face, const RECT *dirty_rect)
 {
     IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
-    IWineD3DSurface *surface;
+    IWineD3DSurfaceImpl *surface;
 
     TRACE("iface %p, face %u, dirty_rect %s.\n",
             iface, face, wine_dbgstr_rect(dirty_rect));
 
-    if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, 0)))
+    if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, face, 0)))
     {
         WARN("Failed to get sub-resource.\n");
         return WINED3DERR_INVALIDCALL;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index d5df8e2..fcdfec8 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -446,7 +446,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
     }
 
     /* Mark the texture as dirty so that it gets loaded first time around. */
-    surface_add_dirty_rect((IWineD3DSurface *)surface, NULL);
+    surface_add_dirty_rect(surface, NULL);
     list_init(&surface->renderbuffers);
 
     TRACE("surface %p, memory %p, size %u\n", surface, surface->resource.allocatedMemory, surface->resource.size);
@@ -953,35 +953,35 @@ GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface)
 }
 
 /* Slightly inefficient way to handle multiple dirty rects but it works :) */
-void surface_add_dirty_rect(IWineD3DSurface *iface, const RECT *dirty_rect)
+void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect)
 {
-    IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
     IWineD3DBaseTexture *baseTexture = NULL;
 
-    if (!(This->Flags & SFLAG_INSYSMEM) && (This->Flags & SFLAG_INTEXTURE))
-        IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL /* no partial locking for textures yet */);
+    TRACE("surface %p, dirty_rect %s.\n", surface, wine_dbgstr_rect(dirty_rect));
 
-    IWineD3DSurface_ModifyLocation(iface, SFLAG_INSYSMEM, TRUE);
+    if (!(surface->Flags & SFLAG_INSYSMEM) && (surface->Flags & SFLAG_INTEXTURE))
+        /* No partial locking for textures yet. */
+        IWineD3DSurface_LoadLocation((IWineD3DSurface *)surface, SFLAG_INSYSMEM, NULL);
+
+    IWineD3DSurface_ModifyLocation((IWineD3DSurface *)surface, SFLAG_INSYSMEM, TRUE);
     if (dirty_rect)
     {
-        This->dirtyRect.left = min(This->dirtyRect.left, dirty_rect->left);
-        This->dirtyRect.top = min(This->dirtyRect.top, dirty_rect->top);
-        This->dirtyRect.right = max(This->dirtyRect.right, dirty_rect->right);
-        This->dirtyRect.bottom = max(This->dirtyRect.bottom, dirty_rect->bottom);
+        surface->dirtyRect.left = min(surface->dirtyRect.left, dirty_rect->left);
+        surface->dirtyRect.top = min(surface->dirtyRect.top, dirty_rect->top);
+        surface->dirtyRect.right = max(surface->dirtyRect.right, dirty_rect->right);
+        surface->dirtyRect.bottom = max(surface->dirtyRect.bottom, dirty_rect->bottom);
     }
     else
     {
-        This->dirtyRect.left = 0;
-        This->dirtyRect.top = 0;
-        This->dirtyRect.right = This->currentDesc.Width;
-        This->dirtyRect.bottom = This->currentDesc.Height;
+        surface->dirtyRect.left = 0;
+        surface->dirtyRect.top = 0;
+        surface->dirtyRect.right = surface->currentDesc.Width;
+        surface->dirtyRect.bottom = surface->currentDesc.Height;
     }
 
-    TRACE("(%p) : Dirty: yes, Rect:(%d, %d, %d, %d)\n", This, This->dirtyRect.left,
-            This->dirtyRect.top, This->dirtyRect.right, This->dirtyRect.bottom);
-
     /* if the container is a basetexture then mark it dirty. */
-    if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&baseTexture)))
+    if (SUCCEEDED(IWineD3DSurface_GetContainer((IWineD3DSurface *)surface,
+            &IID_IWineD3DBaseTexture, (void **)&baseTexture)))
     {
         TRACE("Passing to container\n");
         IWineD3DBaseTexture_SetDirty(baseTexture, TRUE);
@@ -1767,7 +1767,7 @@ lock_end:
          * Dirtify on lock
          * as seen in msdn docs
          */
-        surface_add_dirty_rect(iface, pRect);
+        surface_add_dirty_rect(This, pRect);
 
         /** Dirtify Container if needed */
         if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&pBaseTexture))) {
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 0de3f06..258dea2 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -408,11 +408,11 @@ static HRESULT WINAPI IWineD3DTextureImpl_UnlockRect(IWineD3DTexture *iface, UIN
 static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, const RECT *dirty_rect)
 {
     IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
-    IWineD3DSurface *surface;
+    IWineD3DSurfaceImpl *surface;
 
     TRACE("iface %p, dirty_rect %s.\n", iface, wine_dbgstr_rect(dirty_rect));
 
-    if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, 0)))
+    if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, 0, 0)))
     {
         WARN("Failed to get sub-resource.\n");
         return WINED3DERR_INVALIDCALL;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e8f8d6a..70ecb22 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2673,7 +2673,7 @@ void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock,
 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;
+void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect) 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;
-- 
1.6.4.4




More information about the wine-patches mailing list