mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 13:23:37 +00:00
d3dx10/sprite: Store projection matrix.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c09f114319
commit
66d7ba2d8c
|
@ -32,6 +32,7 @@ struct d3dx10_sprite
|
|||
ID3DX10Sprite ID3DX10Sprite_iface;
|
||||
LONG refcount;
|
||||
|
||||
D3DXMATRIX projection;
|
||||
ID3D10Device *device;
|
||||
};
|
||||
|
||||
|
@ -139,16 +140,30 @@ static HRESULT WINAPI d3dx10_sprite_SetViewTransform(ID3DX10Sprite *iface, D3DXM
|
|||
static HRESULT WINAPI d3dx10_sprite_GetProjectionTransform(ID3DX10Sprite *iface,
|
||||
D3DXMATRIX *transform)
|
||||
{
|
||||
FIXME("iface %p, transform %p stub!\n", iface, transform);
|
||||
struct d3dx10_sprite *sprite = impl_from_ID3DX10Sprite(iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("iface %p, transform %p.\n", iface, transform);
|
||||
|
||||
if (!transform)
|
||||
return E_FAIL;
|
||||
|
||||
*transform = sprite->projection;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_SetProjectionTransform(ID3DX10Sprite *iface, D3DXMATRIX *transform)
|
||||
{
|
||||
FIXME("iface %p, transform %p stub!\n", iface, transform);
|
||||
struct d3dx10_sprite *sprite = impl_from_ID3DX10Sprite(iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("iface %p, transform %p.\n", iface, transform);
|
||||
|
||||
if (!transform)
|
||||
return E_FAIL;
|
||||
|
||||
sprite->projection = *transform;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_GetDevice(ID3DX10Sprite *iface, ID3D10Device **device)
|
||||
|
@ -201,6 +216,10 @@ HRESULT WINAPI D3DX10CreateSprite(ID3D10Device *device, UINT size, ID3DX10Sprite
|
|||
object->refcount = 1;
|
||||
object->device = device;
|
||||
ID3D10Device_AddRef(device);
|
||||
object->projection._11 = 1.0f;
|
||||
object->projection._22 = 1.0f;
|
||||
object->projection._33 = 1.0f;
|
||||
object->projection._44 = 1.0f;
|
||||
|
||||
*sprite = &object->ID3DX10Sprite_iface;
|
||||
|
||||
|
|
|
@ -2968,6 +2968,13 @@ static void test_sprite(void)
|
|||
D3DXMATRIX mat, mat2;
|
||||
ULONG refcount;
|
||||
HRESULT hr;
|
||||
static const D3DXMATRIX identity =
|
||||
{
|
||||
._11 = 1.0f,
|
||||
._22 = 1.0f,
|
||||
._33 = 1.0f,
|
||||
._44 = 1.0f,
|
||||
};
|
||||
|
||||
if (!(device = create_device()))
|
||||
{
|
||||
|
@ -3020,11 +3027,10 @@ static void test_sprite(void)
|
|||
|
||||
/* Projection transform */
|
||||
hr = ID3DX10Sprite_GetProjectionTransform(sprite, NULL);
|
||||
todo_wine
|
||||
ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr);
|
||||
hr = ID3DX10Sprite_GetProjectionTransform(sprite, &mat);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(!memcmp(&mat, &identity, sizeof(mat)), "Unexpected projection transform.\n");
|
||||
|
||||
/* Set a transform and test if it gets returned correctly */
|
||||
mat.m[0][0] = 2.1f; mat.m[0][1] = 6.5f; mat.m[0][2] =-9.6f; mat.m[0][3] = 1.7f;
|
||||
|
@ -3033,18 +3039,14 @@ todo_wine
|
|||
mat.m[3][0] = 6.7f; mat.m[3][1] =-5.1f; mat.m[3][2] = 6.1f; mat.m[3][3] = 2.2f;
|
||||
|
||||
hr = ID3DX10Sprite_SetProjectionTransform(sprite, NULL);
|
||||
todo_wine
|
||||
ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3DX10Sprite_SetProjectionTransform(sprite, &mat);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3DX10Sprite_GetProjectionTransform(sprite, &mat2);
|
||||
todo_wine {
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(!memcmp(&mat, &mat2, sizeof(mat)), "Unexpected matrix.\n");
|
||||
}
|
||||
|
||||
/* View transform */
|
||||
hr = ID3DX10Sprite_SetViewTransform(sprite, NULL);
|
||||
|
|
Loading…
Reference in a new issue