DXGL r497 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r496‎ | r497 | r498 >
Date:17:12, 23 August 2014
Author:admin
Status:new
Tags:
Comment:
Fill in function pointer tables for glDirect3DViewport structures on creation.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)
  • /ddraw/glDirect3DViewport.cpp (modified) (history)
  • /ddraw/glDirect3DViewport.h (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -788,11 +788,11 @@
789789 TRACE_ENTER(3,14,this,14,lplpD3DViewport2,14,pUnkOuter);
790790 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
791791 if(!lplpD3DViewport2) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
792 - glDirect3DMaterial3 *glD3DV3;
 792+ glDirect3DViewport3 *glD3DV3;
793793 HRESULT error = glD3D7->CreateViewport((LPDIRECT3DVIEWPORT3*)&glD3DV3,pUnkOuter);
794794 if(FAILED(error)) TRACE_RET(HRESULT,23,error);
795 - glD3DV3->QueryInterface(IID_IDirect3DViewport2,(void**)lplpD3DViewport2);
796 - glD3DV3->Release();
 795+ glDirect3DViewport3_QueryInterface(glD3DV3,IID_IDirect3DViewport2,(void**)lplpD3DViewport2);
 796+ glDirect3DViewport3_Release(glD3DV3);
797797 TRACE_VAR("*lplpD3DViewport2",14,*lplpD3DViewport2);
798798 TRACE_EXIT(23,D3D_OK);
799799 return D3D_OK;
@@ -891,11 +891,11 @@
892892 TRACE_ENTER(3,14,this,14,lplpD3DViewport,14,pUnkOuter);
893893 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
894894 if(!lplpD3DViewport) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
895 - glDirect3DMaterial3 *glD3DV3;
 895+ glDirect3DViewport3 *glD3DV3;
896896 HRESULT error = glD3D7->CreateViewport((LPDIRECT3DVIEWPORT3*)&glD3DV3,pUnkOuter);
897897 if(FAILED(error)) TRACE_RET(HRESULT,23,error);
898 - glD3DV3->QueryInterface(IID_IDirect3DViewport,(void**)lplpD3DViewport);
899 - glD3DV3->Release();
 898+ glDirect3DViewport3_QueryInterface(glD3DV3,IID_IDirect3DViewport,(void**)lplpD3DViewport);
 899+ glDirect3DViewport3_Release(glD3DV3);
900900 TRACE_VAR("*lplpD3DViewport",14,*lplpD3DViewport);
901901 TRACE_EXIT(23,D3D_OK);
902902 return D3D_OK;
Index: ddraw/glDirect3DViewport.cpp
@@ -38,6 +38,31 @@
3939 return b|(g<<8)|(r<<16)|(a<<24);
4040 }
4141
 42+glDirect3DViewport3Vtbl glDirect3DViewport3_iface =
 43+{
 44+ glDirect3DViewport3_QueryInterface,
 45+ glDirect3DViewport3_AddRef,
 46+ glDirect3DViewport3_Release,
 47+ glDirect3DViewport3_Initialize,
 48+ glDirect3DViewport3_GetViewport,
 49+ glDirect3DViewport3_SetViewport,
 50+ glDirect3DViewport3_TransformVertices,
 51+ glDirect3DViewport3_LightElements,
 52+ glDirect3DViewport3_SetBackground,
 53+ glDirect3DViewport3_GetBackground,
 54+ glDirect3DViewport3_SetBackgroundDepth,
 55+ glDirect3DViewport3_GetBackgroundDepth,
 56+ glDirect3DViewport3_Clear,
 57+ glDirect3DViewport3_AddLight,
 58+ glDirect3DViewport3_DeleteLight,
 59+ glDirect3DViewport3_NextLight,
 60+ glDirect3DViewport3_GetViewport2,
 61+ glDirect3DViewport3_SetViewport2,
 62+ glDirect3DViewport3_SetBackgroundDepth2,
 63+ glDirect3DViewport3_GetBackgroundDepth2,
 64+ glDirect3DViewport3_Clear2
 65+};
 66+
4267 HRESULT glDirect3DViewport3_Create(LPDIRECT3DVIEWPORT3 *viewport)
4368 {
4469 glDirect3DViewport3 *newvp;
@@ -46,6 +71,7 @@
4772 newvp = (glDirect3DViewport3*)malloc(sizeof(glDirect3DViewport3));
4873 if (!newvp) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
4974 *viewport = (LPDIRECT3DVIEWPORT3)newvp;
 75+ newvp->lpVtbl = &glDirect3DViewport3_iface;
5076 newvp->background = 0;
5177 ZeroMemory(&newvp->viewport,sizeof(D3DVIEWPORT2));
5278 newvp->viewport.dwSize = sizeof(D3DVIEWPORT2);
@@ -95,7 +121,7 @@
96122 }
97123 else
98124 {
99 - ret = glDirect3DViewport2_Create(This, (LPDIRECT3DVIEWPORT2*)*ppvObj);
 125+ ret = glDirect3DViewport2_Create(This, (LPDIRECT3DVIEWPORT2*)ppvObj);
100126 if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
101127 glDirect3DViewport3_AddRef(This);
102128 This->glD3DV2 = (glDirect3DViewport2*)*ppvObj;
@@ -116,7 +142,7 @@
117143 }
118144 else
119145 {
120 - ret = glDirect3DViewport1_Create(This, (LPDIRECT3DVIEWPORT*)*ppvObj);
 146+ ret = glDirect3DViewport1_Create(This, (LPDIRECT3DVIEWPORT*)ppvObj);
121147 if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
122148 glDirect3DViewport3_AddRef(This);
123149 This->glD3DV1 = (glDirect3DViewport1*)*ppvObj;
@@ -450,6 +476,27 @@
451477 TRACE_EXIT(0,0);
452478 }
453479
 480+glDirect3DViewport2Vtbl glDirect3DViewport2_iface =
 481+{
 482+ glDirect3DViewport2_QueryInterface,
 483+ glDirect3DViewport2_AddRef,
 484+ glDirect3DViewport2_Release,
 485+ glDirect3DViewport2_Initialize,
 486+ glDirect3DViewport2_GetViewport,
 487+ glDirect3DViewport2_SetViewport,
 488+ glDirect3DViewport2_TransformVertices,
 489+ glDirect3DViewport2_LightElements,
 490+ glDirect3DViewport2_SetBackground,
 491+ glDirect3DViewport2_GetBackground,
 492+ glDirect3DViewport2_SetBackgroundDepth,
 493+ glDirect3DViewport2_GetBackgroundDepth,
 494+ glDirect3DViewport2_Clear,
 495+ glDirect3DViewport2_AddLight,
 496+ glDirect3DViewport2_DeleteLight,
 497+ glDirect3DViewport2_NextLight,
 498+ glDirect3DViewport2_GetViewport2,
 499+ glDirect3DViewport2_SetViewport2
 500+};
454501
455502 HRESULT glDirect3DViewport2_Create(glDirect3DViewport3 *glD3DV3, LPDIRECT3DVIEWPORT2 *viewport)
456503 {
@@ -459,6 +506,7 @@
460507 newvp = (glDirect3DViewport2*)malloc(sizeof(glDirect3DViewport2));
461508 if (!newvp) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
462509 *viewport = (LPDIRECT3DVIEWPORT2)newvp;
 510+ newvp->lpVtbl = &glDirect3DViewport2_iface;
463511 newvp->glD3DV3 = glD3DV3;
464512 newvp->refcount = 1;
465513 TRACE_EXIT(23, DD_OK);
@@ -598,6 +646,26 @@
599647 }
600648
601649
 650+glDirect3DViewport1Vtbl glDirect3DViewport1_iface =
 651+{
 652+ glDirect3DViewport1_QueryInterface,
 653+ glDirect3DViewport1_AddRef,
 654+ glDirect3DViewport1_Release,
 655+ glDirect3DViewport1_Initialize,
 656+ glDirect3DViewport1_GetViewport,
 657+ glDirect3DViewport1_SetViewport,
 658+ glDirect3DViewport1_TransformVertices,
 659+ glDirect3DViewport1_LightElements,
 660+ glDirect3DViewport1_SetBackground,
 661+ glDirect3DViewport1_GetBackground,
 662+ glDirect3DViewport1_SetBackgroundDepth,
 663+ glDirect3DViewport1_GetBackgroundDepth,
 664+ glDirect3DViewport1_Clear,
 665+ glDirect3DViewport1_AddLight,
 666+ glDirect3DViewport1_DeleteLight,
 667+ glDirect3DViewport1_NextLight
 668+};
 669+
602670 HRESULT glDirect3DViewport1_Create(glDirect3DViewport3 *glD3DV3, LPDIRECT3DVIEWPORT *viewport)
603671 {
604672 glDirect3DViewport1 *newvp;
@@ -606,6 +674,7 @@
607675 newvp = (glDirect3DViewport1*)malloc(sizeof(glDirect3DViewport1));
608676 if (!newvp) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
609677 *viewport = (LPDIRECT3DVIEWPORT)newvp;
 678+ newvp->lpVtbl = &glDirect3DViewport1_iface;
610679 newvp->glD3DV3 = glD3DV3;
611680 newvp->refcount = 1;
612681 TRACE_EXIT(23, DD_OK);
Index: ddraw/glDirect3DViewport.h
@@ -53,7 +53,7 @@
5454 bool current;
5555 };
5656
57 -typedef struct glDirect3DViewportVtbl
 57+typedef struct glDirect3DViewport3Vtbl
5858 {
5959 HRESULT(WINAPI *QueryInterface)(glDirect3DViewport3 *This, REFIID riid, void** ppvObj);
6060 ULONG(WINAPI *AddRef)(glDirect3DViewport3 *This);