Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: d3drmtexture3obj.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // d3drmTextureObj.cpp : Implementation of CDirectApp and DLL registration.
  11. #include "stdafx.h"
  12. #include "Direct.h"
  13. #include "dms.h"
  14. #include "d3drmTexture3Obj.h"
  15. #include "ddSurface4Obj.h"
  16. CONSTRUCTOR(_dxj_Direct3dRMTexture3, {
  17. m_buffer1 = NULL;
  18. m_buffer1size = 0;
  19. m_buffer2 = NULL;
  20. m_buffer2size = 0;
  21. m_pallette = NULL;
  22. m_palettesize = 0;
  23. })
  24. DESTRUCTOR(_dxj_Direct3dRMTexture3, {
  25. if ( m_buffer1 )
  26. free(m_buffer1);
  27. if ( m_buffer2 )
  28. free(m_buffer2);
  29. if ( m_pallette )
  30. free(m_pallette);
  31. })
  32. GETSET_OBJECT(_dxj_Direct3dRMTexture3)
  33. CLONE_R(_dxj_Direct3dRMTexture3,Direct3DRMTexture3);
  34. GETNAME_R(_dxj_Direct3dRMTexture3);
  35. SETNAME_R(_dxj_Direct3dRMTexture3);
  36. GETCLASSNAME_R(_dxj_Direct3dRMTexture3);
  37. ADDDESTROYCALLBACK_R(_dxj_Direct3dRMTexture3);
  38. DELETEDESTROYCALLBACK_R(_dxj_Direct3dRMTexture3);
  39. PASS_THROUGH_CAST_1_R(_dxj_Direct3dRMTexture3, setAppData, SetAppData, long,(DWORD));
  40. PASS_THROUGH_CAST_1_R(_dxj_Direct3dRMTexture3, setColors, SetColors, long,(DWORD));
  41. PASS_THROUGH_CAST_1_R(_dxj_Direct3dRMTexture3, setShades, SetShades, long,(DWORD));
  42. PASS_THROUGH_CAST_1_R(_dxj_Direct3dRMTexture3, setDecalScale, SetDecalScale, long,(DWORD));
  43. PASS_THROUGH_CAST_1_R(_dxj_Direct3dRMTexture3, setDecalTransparency, SetDecalTransparency, long,(DWORD));
  44. PASS_THROUGH_CAST_1_R(_dxj_Direct3dRMTexture3, setDecalTransparentColor, SetDecalTransparentColor, d3dcolor,(DWORD));
  45. PASS_THROUGH2_R(_dxj_Direct3dRMTexture3, setDecalSize, SetDecalSize, d3dvalue, d3dvalue);
  46. PASS_THROUGH_CAST_2_R(_dxj_Direct3dRMTexture3, setDecalOrigin, SetDecalOrigin, long,(DWORD),long,(DWORD));
  47. PASS_THROUGH2_R(_dxj_Direct3dRMTexture3, getDecalSize, GetDecalSize, D3DVALUE*, D3DVALUE*);
  48. PASS_THROUGH_CAST_2_R(_dxj_Direct3dRMTexture3, getDecalOrigin, GetDecalOrigin, long*, (long*), long*,(long*));
  49. GET_DIRECT_R(_dxj_Direct3dRMTexture3, getAppData, GetAppData, long);
  50. GET_DIRECT_R(_dxj_Direct3dRMTexture3, getShades, GetShades, long);
  51. GET_DIRECT_R(_dxj_Direct3dRMTexture3, getColors, GetColors, long);
  52. GET_DIRECT_R(_dxj_Direct3dRMTexture3, getDecalScale, GetDecalScale, long);
  53. GET_DIRECT_R(_dxj_Direct3dRMTexture3, getDecalTransparency, GetDecalTransparency, long);
  54. GET_DIRECT_R(_dxj_Direct3dRMTexture3, getDecalTransparentColor, GetDecalTransparentColor, d3dcolor);
  55. /////////////////////////////////////////////////////////////////////////////
  56. STDMETHODIMP C_dxj_Direct3dRMTexture3Object::generateMIPMap()
  57. {
  58. return m__dxj_Direct3dRMTexture3->GenerateMIPMap(0);
  59. }
  60. /////////////////////////////////////////////////////////////////////////////
  61. STDMETHODIMP C_dxj_Direct3dRMTexture3Object::changed(long flags, long nRects, SAFEARRAY **psa)
  62. {
  63. if ((nRects)&&(!ISSAFEARRAY1D(psa,(DWORD)nRects)))
  64. return E_INVALIDARG;
  65. return m__dxj_Direct3dRMTexture3->Changed((DWORD)flags,(DWORD)nRects,(RECT*)((SAFEARRAY*)*psa)->pvData);
  66. }
  67. STDMETHODIMP C_dxj_Direct3dRMTexture3Object::getCacheFlags(long *flags)
  68. {
  69. long temp;
  70. return m__dxj_Direct3dRMTexture3->GetCacheOptions(&temp,(DWORD*)flags);
  71. }
  72. STDMETHODIMP C_dxj_Direct3dRMTexture3Object::getCacheImportance(long *import)
  73. {
  74. DWORD temp;
  75. return m__dxj_Direct3dRMTexture3->GetCacheOptions(import,&temp);
  76. }
  77. STDMETHODIMP C_dxj_Direct3dRMTexture3Object::setCacheOptions(long import, long flags)
  78. {
  79. return m__dxj_Direct3dRMTexture3->SetCacheOptions(import,(DWORD)flags);
  80. }
  81. STDMETHODIMP C_dxj_Direct3dRMTexture3Object::getSurface(long flags, I_dxj_DirectDrawSurface4 **ppret)
  82. {
  83. HRESULT hr;
  84. LPDIRECTDRAWSURFACE lpSurf1=NULL;
  85. LPDIRECTDRAWSURFACE4 lpSurf4=NULL;
  86. *ppret=NULL;
  87. hr=m__dxj_Direct3dRMTexture3->GetSurface((DWORD)flags,&lpSurf1);
  88. if FAILED(hr) return hr;
  89. hr=lpSurf1->QueryInterface(IID_IDirectDrawSurface4,(void**)&lpSurf4);
  90. lpSurf1->Release();
  91. if FAILED(hr) return hr;
  92. INTERNAL_CREATE(_dxj_DirectDrawSurface4,lpSurf4,ppret);
  93. if (*ppret==NULL) {
  94. lpSurf4->Release();
  95. return hr;
  96. }
  97. return hr;
  98. }