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.

128 lines
3.6 KiB

  1. /***************************************************************************\
  2. *
  3. * File: DxManager.h
  4. *
  5. * Description:
  6. * DxManager.h defines the process-wide DirectX manager used for all
  7. * DirectDraw, Direct3D, and DirectX Transforms services.
  8. *
  9. *
  10. * History:
  11. * 1/18/2000: JStall: Created
  12. *
  13. * Copyright (C) 2000 by Microsoft Corporation. All rights reserved.
  14. *
  15. \***************************************************************************/
  16. #if !defined(SERVICES__DXManager_h__INCLUDED)
  17. #define SERVICES__DXManager_h__INCLUDED
  18. #pragma once
  19. #pragma comment(lib, "dxguid.lib") // Include DirectX GUID's
  20. struct IDirectDraw;
  21. struct IDXTransformFactory;
  22. struct IDXSurfaceFactory;
  23. struct IDXSurface;
  24. typedef HRESULT (WINAPI * DirectDrawCreateProc)(GUID * pguid, IDirectDraw ** ppDD, IUnknown * punkOuter);
  25. typedef HRESULT (WINAPI * DirectDrawCreateExProc)(GUID * pguid, void ** ppvDD, REFIID iid, IUnknown * punkOuter);
  26. class DxSurface;
  27. /***************************************************************************\
  28. *
  29. * class DxManager
  30. *
  31. * DxManager maintains interaction with DirectX technologies including:
  32. * - DirectDraw
  33. * - Direct3D
  34. * - DirectTransforms
  35. *
  36. * By using this class instead of directly accessing DX, bettern coordination
  37. * is maintained throughout SERVICES.
  38. *
  39. * NOTE: This manager is delay-loads DLL's to manage performance and work on
  40. * down-level platforms.
  41. *
  42. \***************************************************************************/
  43. class DxManager
  44. {
  45. // Construction
  46. public:
  47. DxManager();
  48. ~DxManager();
  49. // Operations
  50. public:
  51. HRESULT Init(GUID * pguidDriver = NULL);
  52. void Uninit();
  53. inline BOOL IsInit() const;
  54. HRESULT InitDxTx();
  55. void UninitDxTx();
  56. inline BOOL IsDxTxInit() const;
  57. inline IDXTransformFactory * GetTransformFactory() const;
  58. inline IDXSurfaceFactory * GetSurfaceFactory() const;
  59. HRESULT BuildSurface(SIZE sizePxl, IDirectDrawSurface7 * pddSurfNew);
  60. HRESULT BuildDxSurface(SIZE sizePxl, REFGUID guidFormat, IDXSurface ** ppdxSurfNew);
  61. // Data
  62. protected:
  63. // DirectDraw
  64. UINT m_cDDrawRef;
  65. HINSTANCE m_hDllDxDraw; // DirectDraw DLL
  66. DirectDrawCreateProc m_pfnCreate;
  67. DirectDrawCreateExProc m_pfnCreateEx;
  68. IDirectDraw * m_pDD;
  69. IDirectDraw7 * m_pDD7;
  70. // DX Transforms
  71. UINT m_cDxTxRef;
  72. IDXTransformFactory * m_pdxXformFac;
  73. IDXSurfaceFactory * m_pdxSurfFac;
  74. };
  75. /***************************************************************************\
  76. *
  77. * class DxSurface
  78. *
  79. * DxSurface maintains a single DXTX Surface.
  80. *
  81. \***************************************************************************/
  82. class DxSurface
  83. {
  84. // Construction
  85. public:
  86. DxSurface();
  87. ~DxSurface();
  88. HRESULT Create(SIZE sizePxl);
  89. // Operations
  90. public:
  91. inline IDXSurface* GetSurface() const;
  92. BOOL CopyDC(HDC hdcSrc, const RECT & rcCrop);
  93. BOOL CopyBitmap(HBITMAP hbmpSrc, const RECT * prcCrop);
  94. inline SIZE GetSize() const;
  95. // Implementation
  96. protected:
  97. BOOL FixAlpha();
  98. // Data
  99. protected:
  100. IDXSurface * m_pdxSurface;
  101. SIZE m_sizePxl; // (Cached) size of surface in pixels
  102. GUID m_guidFormat; // (Cached) format of the surface
  103. DXSAMPLEFORMATENUM m_sf; // Sample Format
  104. };
  105. #include "DxManager.inl"
  106. #endif // SERVICES__DXManager_h__INCLUDED