[PATCH 3/5] wined3d: Remove surface->dirtyRect.

Stefan Dösinger stefan at codeweavers.com
Wed Nov 20 05:33:32 CST 2013


---
 dlls/wined3d/surface.c         | 47 ++++--------------------------------------
 dlls/wined3d/texture.c         |  2 +-
 dlls/wined3d/wined3d_private.h |  3 +--
 3 files changed, 6 insertions(+), 46 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index c69b67b..a4c22f7 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -850,22 +850,7 @@ static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD
     }
 
     if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY)))
-    {
-        if (!rect)
-            surface_add_dirty_rect(surface, NULL);
-        else
-        {
-            struct wined3d_box b;
-
-            b.left = rect->left;
-            b.top = rect->top;
-            b.right = rect->right;
-            b.bottom = rect->bottom;
-            b.front = 0;
-            b.back = 1;
-            surface_add_dirty_rect(surface, &b);
-        }
-    }
+        surface_set_dirty(surface);
 }
 
 static void surface_unmap(struct wined3d_surface *surface)
@@ -904,18 +889,9 @@ static void surface_unmap(struct wined3d_surface *surface)
     }
 
     if (surface->swapchain && surface->swapchain->front_buffer == surface)
-    {
         surface_load_location(surface, surface->draw_binding);
-
-        surface->dirtyRect.left = surface->resource.width;
-        surface->dirtyRect.top = surface->resource.height;
-        surface->dirtyRect.right = 0;
-        surface->dirtyRect.bottom = 0;
-    }
     else if (surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
-    {
         FIXME("Depth / stencil buffer locking is not implemented.\n");
-    }
 }
 
 static BOOL surface_is_full_rect(const struct wined3d_surface *surface, const RECT *r)
@@ -2314,9 +2290,9 @@ GLenum surface_get_gl_buffer(const struct wined3d_surface *surface)
 }
 
 /* Slightly inefficient way to handle multiple dirty rects but it works :) */
-void surface_add_dirty_rect(struct wined3d_surface *surface, const struct wined3d_box *dirty_rect)
+void surface_set_dirty(struct wined3d_surface *surface)
 {
-    TRACE("surface %p, dirty_rect %p.\n", surface, dirty_rect);
+    TRACE("surface %p.\n", surface);
 
     if (!(surface->flags & SFLAG_INSYSMEM) && (surface->flags & SFLAG_INTEXTURE))
         surface_load_location(surface, SFLAG_INSYSMEM);
@@ -2324,21 +2300,6 @@ void surface_add_dirty_rect(struct wined3d_surface *surface, const struct wined3
     surface_validate_location(surface, SFLAG_INSYSMEM);
     surface_invalidate_location(surface, ~SFLAG_INSYSMEM);
 
-    if (dirty_rect)
-    {
-        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
-    {
-        surface->dirtyRect.left = 0;
-        surface->dirtyRect.top = 0;
-        surface->dirtyRect.right = surface->resource.width;
-        surface->dirtyRect.bottom = surface->resource.height;
-    }
-
     wined3d_texture_set_dirty(surface->container);
 }
 
@@ -6635,7 +6596,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
         surface->flags |= SFLAG_DYNLOCK;
 
     /* Mark the texture as dirty so that it gets loaded first time around. */
-    surface_add_dirty_rect(surface, NULL);
+    surface_set_dirty(surface);
     list_init(&surface->renderbuffers);
 
     TRACE("surface %p, memory %p, size %u\n",
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 8bae223..7bafa66 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -689,7 +689,7 @@ static void texture2d_preload(struct wined3d_texture *texture,
 static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource,
         const struct wined3d_box *dirty_region)
 {
-    surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region);
+    surface_set_dirty(surface_from_resource(sub_resource));
 }
 
 static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9e67c9b..e56f501 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2202,7 +2202,6 @@ struct wined3d_surface
     GLenum texture_target;
 
     RECT                      lockedRect;
-    RECT                      dirtyRect;
     int                       lockCount;
 
     /* For GetDC */
@@ -2242,7 +2241,7 @@ static inline GLuint surface_get_texture_name(const struct wined3d_surface *surf
             ? surface->container->texture_srgb.name : surface->container->texture_rgb.name;
 }
 
-void surface_add_dirty_rect(struct wined3d_surface *surface, const struct wined3d_box *dirty_rect) DECLSPEC_HIDDEN;
+void surface_set_dirty(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 HRESULT surface_color_fill(struct wined3d_surface *s,
         const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
 GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
-- 
1.8.3.2




More information about the wine-patches mailing list