=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Simplify buffer_is_fully_dirty ().

Alexandre Julliard julliard at winehq.org
Fri May 27 09:42:32 CDT 2016


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri May 27 11:03:53 2016 +0200

wined3d: Simplify buffer_is_fully_dirty().

The buffer_invalidate_bo_range() ensures that if the whole buffer was
invalidated the dirty areas array contains exactly one element.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/buffer.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 5ddf67d..c82bfdb 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -89,14 +89,8 @@ static BOOL buffer_is_dirty(const struct wined3d_buffer *buffer)
 
 static BOOL buffer_is_fully_dirty(const struct wined3d_buffer *buffer)
 {
-    unsigned int i;
-
-    for (i = 0; i < buffer->modified_areas; ++i)
-    {
-        if (!buffer->maps[i].offset && buffer->maps[i].size == buffer->resource.size)
-            return TRUE;
-    }
-    return FALSE;
+    return buffer->modified_areas == 1
+            && !buffer->maps->offset && buffer->maps->size == buffer->resource.size;
 }
 
 /* Context activation is done by the caller. */
@@ -1348,10 +1342,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
         }
     }
 
-    buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps));
-    if (!buffer->maps)
+    if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps))))
     {
-        ERR("Out of memory\n");
+        ERR("Out of memory.\n");
         buffer_unload(&buffer->resource);
         resource_cleanup(&buffer->resource);
         return E_OUTOFMEMORY;




More information about the wine-cvs mailing list