<div dir="ltr"><div><div>Hi,<br></div><div><br>Please ignore this and go for v4 of this patch instead.<br><br></div>Cheers,<br></div>Aaryaman<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 10, 2016 at 9:07 PM, Aaryaman Vasishta <span dir="ltr"><<a href="mailto:jem456.vasishta@gmail.com" target="_blank">jem456.vasishta@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">v3: Directly traverse through parent frames instead of using GetParent.<br>
<br>
Signed-off-by: Aaryaman Vasishta <<a href="mailto:jem456.vasishta@gmail.com">jem456.vasishta@gmail.com</a>><br>
---<br>
dlls/d3drm/frame.c | 46 ++++++++++++++++++++++++++++++<wbr>++++++++++------<br>
dlls/d3drm/tests/d3drm.c | 24 ++++++++++++++++++++++++<br>
2 files changed, 64 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c<br>
index 2ff0241..312007b 100644<br>
--- a/dlls/d3drm/frame.c<br>
+++ b/dlls/d3drm/frame.c<br>
@@ -1339,23 +1339,57 @@ static HRESULT WINAPI d3drm_frame1_GetRotation(<wbr>IDirect3DRMFrame *iface,<br>
<br>
static HRESULT WINAPI d3drm_frame3_GetScene(<wbr>IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 **scene)<br>
{<br>
- FIXME("iface %p, scene %p stub!\n", iface, scene);<br>
+ struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(<wbr>iface);<br>
<br>
- return E_NOTIMPL;<br>
+ TRACE("iface %p, scene %p.\n", iface, scene);<br>
+<br>
+ if (!scene)<br>
+ return D3DRMERR_BADVALUE;<br>
+<br>
+ *scene = &frame->IDirect3DRMFrame3_<wbr>iface;<br>
+<br>
+ while (frame->parent)<br>
+ {<br>
+ frame = frame->parent;<br>
+ *scene = &frame->IDirect3DRMFrame3_<wbr>iface;<br>
+ }<br>
+<br>
+ IDirect3DRMFrame3_AddRef(*<wbr>scene);<br>
+<br>
+ return D3DRM_OK;<br>
}<br>
<br>
static HRESULT WINAPI d3drm_frame2_GetScene(<wbr>IDirect3DRMFrame2 *iface, IDirect3DRMFrame **scene)<br>
{<br>
- FIXME("iface %p, scene %p stub!\n", iface, scene);<br>
+ struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(<wbr>iface);<br>
+ IDirect3DRMFrame3 *frame3;<br>
+ HRESULT hr;<br>
<br>
- return E_NOTIMPL;<br>
+ TRACE("iface %p, scene %p.\n", iface, scene);<br>
+<br>
+ if (!scene)<br>
+ return D3DRMERR_BADVALUE;<br>
+<br>
+ hr = IDirect3DRMFrame3_GetScene(&<wbr>frame->IDirect3DRMFrame3_<wbr>iface, &frame3);<br>
+ if (FAILED(hr) || !frame3)<br>
+ {<br>
+ *scene = NULL;<br>
+ return hr;<br>
+ }<br>
+<br>
+ hr = IDirect3DRMFrame3_<wbr>QueryInterface(frame3, &IID_IDirect3DRMFrame, (void **)scene);<br>
+ IDirect3DRMFrame3_Release(<wbr>frame3);<br>
+<br>
+ return hr;<br>
}<br>
<br>
static HRESULT WINAPI d3drm_frame1_GetScene(<wbr>IDirect3DRMFrame *iface, IDirect3DRMFrame **scene)<br>
{<br>
- FIXME("iface %p, scene %p stub!\n", iface, scene);<br>
+ struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(<wbr>iface);<br>
<br>
- return E_NOTIMPL;<br>
+ TRACE("iface %p, scene %p.\n", iface, scene);<br>
+<br>
+ return d3drm_frame2_GetScene(&frame-><wbr>IDirect3DRMFrame2_iface, scene);<br>
}<br>
<br>
static D3DRMSORTMODE WINAPI d3drm_frame3_GetSortMode(<wbr>IDirect3DRMFrame3 *iface)<br>
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c<br>
index 1abaed5..d86477d 100644<br>
--- a/dlls/d3drm/tests/d3drm.c<br>
+++ b/dlls/d3drm/tests/d3drm.c<br>
@@ -885,6 +885,7 @@ static void test_Frame(void)<br>
IDirect3DRMFrame *pFrameP1;<br>
IDirect3DRMFrame *pFrameP2;<br>
IDirect3DRMFrame *pFrameTmp;<br>
+ IDirect3DRMFrame *scene_frame;<br>
IDirect3DRMFrameArray *frame_array;<br>
IDirect3DRMMeshBuilder *mesh_builder;<br>
IDirect3DRMVisual *visual1;<br>
@@ -967,6 +968,19 @@ static void test_Frame(void)<br>
CHECK_REFCOUNT(pFrameP1, 1);<br>
CHECK_REFCOUNT(pFrameC, 2);<br>
<br>
+ hr = IDirect3DRMFrame_GetScene(<wbr>pFrameC, NULL);<br>
+ ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);<br>
+ hr = IDirect3DRMFrame_GetScene(<wbr>pFrameC, &scene_frame);<br>
+ ok(SUCCEEDED(hr), "Cannot get scene (hr == %#x).\n", hr);<br>
+ ok(scene_frame == pFrameP1, "Expected scene frame == %p, got %p.\n", pFrameP1, scene_frame);<br>
+ CHECK_REFCOUNT(pFrameP1, 2);<br>
+ IDirect3DRMFrame_Release(<wbr>scene_frame);<br>
+ hr = IDirect3DRMFrame_GetScene(<wbr>pFrameP1, &scene_frame);<br>
+ ok(SUCCEEDED(hr), "Cannot get scene (hr == %#x).\n", hr);<br>
+ ok(scene_frame == pFrameP1, "Expected scene frame == %p, got %p.\n", pFrameP1, scene_frame);<br>
+ CHECK_REFCOUNT(pFrameP1, 2);<br>
+ IDirect3DRMFrame_Release(<wbr>scene_frame);<br>
+<br>
frame_array = NULL;<br>
hr = IDirect3DRMFrame_GetChildren(<wbr>pFrameP1, &frame_array);<br>
ok(hr == D3DRM_OK, "Cannot get children (hr = %x)\n", hr);<br>
@@ -1032,6 +1046,16 @@ static void test_Frame(void)<br>
ok(pFrameTmp == NULL, "pFrameTmp = %p\n", pFrameTmp);<br>
IDirect3DRMFrameArray_Release(<wbr>frame_array);<br>
}<br>
+ hr = IDirect3DRMFrame_GetScene(<wbr>pFrameC, &scene_frame);<br>
+ ok(SUCCEEDED(hr), "Cannot get scene (hr == %#x).\n", hr);<br>
+ ok(scene_frame == pFrameP2, "Expected scene frame == %p, got %p.\n", pFrameP2, scene_frame);<br>
+ CHECK_REFCOUNT(pFrameP2, 2);<br>
+ IDirect3DRMFrame_Release(<wbr>scene_frame);<br>
+ hr = IDirect3DRMFrame_GetScene(<wbr>pFrameP2, &scene_frame);<br>
+ ok(SUCCEEDED(hr), "Cannot get scene (hr == %#x).\n", hr);<br>
+ ok(scene_frame == pFrameP2, "Expected scene frame == %p, got %p.\n", pFrameP2, scene_frame);<br>
+ CHECK_REFCOUNT(pFrameP2, 2);<br>
+ IDirect3DRMFrame_Release(<wbr>scene_frame);<br>
<br>
pFrameTmp = (void*)0xdeadbeef;<br>
hr = IDirect3DRMFrame_GetParent(<wbr>pFrameC, &pFrameTmp);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.3.2 (Apple Git-55)<br>
<br>
</font></span></blockquote></div><br></div>