Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/d3drm/frame.c | 59 +++++++++++++++++++++++++++++++++++++++++++----- dlls/d3drm/tests/d3drm.c | 19 ++++++++++++++++ 2 files changed, 72 insertions(+), 6 deletions(-)
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 7bb848b4c6..26f01d85dc 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -1077,25 +1077,72 @@ static HRESULT WINAPI d3drm_frame1_AddTranslation(IDirect3DRMFrame *iface, static HRESULT WINAPI d3drm_frame3_AddScale(IDirect3DRMFrame3 *iface, D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) { - FIXME("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e stub!\n", iface, type, sx, sy, sz); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
- return E_NOTIMPL; + TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz); + + switch (type) + { + case D3DRMCOMBINE_REPLACE: + memcpy(frame->transform, identity, sizeof(D3DRMMATRIX4D)); + frame->transform[0][0] = sx; + frame->transform[1][1] = sy; + frame->transform[2][2] = sz; + break; + + case D3DRMCOMBINE_BEFORE: + frame->transform[0][0] *= sx; + frame->transform[0][1] *= sx; + frame->transform[0][2] *= sx; + frame->transform[1][0] *= sy; + frame->transform[1][1] *= sy; + frame->transform[1][2] *= sy; + frame->transform[2][0] *= sz; + frame->transform[2][1] *= sz; + frame->transform[2][2] *= sz; + break; + + case D3DRMCOMBINE_AFTER: + frame->transform[0][0] *= sx; + frame->transform[0][1] *= sy; + frame->transform[0][2] *= sz; + frame->transform[1][0] *= sx; + frame->transform[1][1] *= sy; + frame->transform[1][2] *= sz; + frame->transform[2][0] *= sx; + frame->transform[2][1] *= sy; + frame->transform[2][2] *= sz; + frame->transform[3][0] *= sx; + frame->transform[3][1] *= sy; + frame->transform[3][2] *= sz; + break; + + default: + WARN("Unknown Combine Type %u\n", type); + return D3DRMERR_BADVALUE; + } + + return D3DRM_OK; }
static HRESULT WINAPI d3drm_frame2_AddScale(IDirect3DRMFrame2 *iface, D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) { - FIXME("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e stub!\n", iface, type, sx, sy, sz); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
- return E_NOTIMPL; + TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz); + + return d3drm_frame3_AddScale(&frame->IDirect3DRMFrame3_iface, type, sx, sy, sz); }
static HRESULT WINAPI d3drm_frame1_AddScale(IDirect3DRMFrame *iface, D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) { - FIXME("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e stub!\n", iface, type, sx, sy, sz); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
- return E_NOTIMPL; + TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz); + + return d3drm_frame3_AddScale(&frame->IDirect3DRMFrame3_iface, type, sx, sy, sz); }
static HRESULT WINAPI d3drm_frame3_AddRotation(IDirect3DRMFrame3 *iface, diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 22869e57c5..ecf23103a7 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2814,6 +2814,25 @@ static void test_frame_transform(void) check_matrix(matrix, 2,0,0, 0,2,0, 0,0,2, 3,3,3, 32);
+ set_transform(frame, 1,0,0, 0,1,0, 0,0,1, 3,3,3); + hr = IDirect3DRMFrame_AddScale(frame, D3DRMCOMBINE_REPLACE, 2.0f, 2.0f, 2.0f); + ok(hr == D3DRM_OK, "Cannot add scale (REPLACE) (hr = %x)", hr); + IDirect3DRMFrame_GetTransform(frame, matrix); + check_matrix(matrix, 2,0,0, 0,2,0, 0,0,2, 0,0,0, 32); + + set_transform(frame, 1,0,0, 0,1,0, 0,0,1, 3,3,3); + hr = IDirect3DRMFrame_AddScale(frame, D3DRMCOMBINE_BEFORE, 2.0f, 2.0f, 2.0f); + ok(hr == D3DRM_OK, "Cannot add scale (BEFORE) (hr = %x)", hr); + IDirect3DRMFrame_GetTransform(frame, matrix); + check_matrix(matrix, 2,0,0, 0,2,0, 0,0,2, 3,3,3, 32); + + set_transform(frame, 1,0,0, 0,1,0, 0,0,1, 3,3,3); + hr = IDirect3DRMFrame_AddScale(frame, D3DRMCOMBINE_AFTER, 2.0f, 2.0f, 2.0f); + ok(hr == D3DRM_OK, "Cannot add scale (AFTER) (hr = %x)", hr); + IDirect3DRMFrame_GetTransform(frame, matrix); + check_matrix(matrix, 2,0,0, 0,2,0, 0,0,2, 6,6,6, 32); + + IDirect3DRMFrame_Release(frame); IDirect3DRM_Release(d3drm); }