Module: wine Branch: master Commit: 556f1dc85465e2d1889066cbb59f9b730112c20d URL: http://source.winehq.org/git/wine.git/?a=commit;h=556f1dc85465e2d1889066cbb5...
Author: Józef Kucia jkucia@codeweavers.com Date: Fri Mar 24 17:14:46 2017 +0100
d3d10core/tests: Introduce get_resource_data() helper function.
Signed-off-by: Józef Kucia jkucia@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d10core/tests/device.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 44f3fae..3e8a1e8 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -568,24 +568,29 @@ static void get_texture_readback(ID3D10Texture2D *texture, unsigned int sub_reso ID3D10Device_Release(device); }
+static void *get_readback_data(struct resource_readback *rb, unsigned int x, unsigned int y, unsigned byte_width) +{ + return (BYTE *)rb->map_desc.pData + y * rb->map_desc.RowPitch + x * byte_width; +} + static DWORD get_readback_color(struct resource_readback *rb, unsigned int x, unsigned int y) { - return ((DWORD *)rb->map_desc.pData)[rb->map_desc.RowPitch * y / sizeof(DWORD) + x]; + return *(DWORD *)get_readback_data(rb, x, y, sizeof(DWORD)); }
static float get_readback_float(struct resource_readback *rb, unsigned int x, unsigned int y) { - return ((float *)rb->map_desc.pData)[rb->map_desc.RowPitch * y / sizeof(float) + x]; + return *(float *)get_readback_data(rb, x, y, sizeof(float)); }
static const struct vec4 *get_readback_vec4(struct resource_readback *rb, unsigned int x, unsigned int y) { - return &((const struct vec4 *)rb->map_desc.pData)[rb->map_desc.RowPitch * y / sizeof(struct vec4) + x]; + return get_readback_data(rb, x, y, sizeof(struct vec4)); }
static const struct uvec4 *get_readback_uvec4(struct resource_readback *rb, unsigned int x, unsigned int y) { - return &((const struct uvec4 *)rb->map_desc.pData)[rb->map_desc.RowPitch * y / sizeof(struct uvec4) + x]; + return get_readback_data(rb, x, y, sizeof(struct uvec4)); }
static void release_resource_readback(struct resource_readback *rb)