Source code of Windows XP (NT5)
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.

149 lines
3.8 KiB

  1. /****************************************************************************
  2. DVA.H
  3. Copyright (c) 1993 Microsoft Corporation
  4. DVA 1.0 Interface Definitions
  5. ***************************************************************************/
  6. #ifndef _INC_DVA
  7. #define _INC_DVA
  8. #ifdef __cplusplus
  9. #define __inline inline
  10. extern "C" {
  11. #endif
  12. /****************************************************************************
  13. ***************************************************************************/
  14. #include "dvaddi.h" // interface to the display driver
  15. /****************************************************************************
  16. ***************************************************************************/
  17. typedef DVASURFACEINFO FAR *PDVA;
  18. typedef PDVA HDVA;
  19. /****************************************************************************
  20. ***************************************************************************/
  21. //
  22. // this code in biCompression means the frame buffer must be accesed via
  23. // 48 bit pointers! using *ONLY* the given selector
  24. //
  25. // BI_1632 has bitmasks (just like BI_BITFIELDS) for biBitCount == 16,24,32
  26. //
  27. #ifndef BI_1632
  28. #define BI_1632 0x32333631 // '1632'
  29. #endif
  30. #ifndef BI_BITFIELDS
  31. #define BI_BITFIELDS 3
  32. #endif
  33. /****************************************************************************
  34. ***************************************************************************/
  35. #if defined(_INC_VFW) || defined(_INC_DRAWDIB)
  36. //
  37. // this API is in MSVIDEO.DLL
  38. //
  39. BOOL VFWAPI DVAGetSurface(HDC hdc, int nSurface, DVASURFACEINFO FAR *lpSurfaceInfo);
  40. #else
  41. //
  42. // this API uses the Escape to the display driver only
  43. //
  44. __inline BOOL DVAGetSurface(HDC hdc, int nSurface, DVASURFACEINFO FAR *pdva)
  45. {
  46. int i;
  47. i = Escape(hdc, DVAGETSURFACE,sizeof(int),(LPCSTR)&nSurface,(LPVOID)pdva);
  48. return i > 0;
  49. }
  50. #endif
  51. /****************************************************************************
  52. ***************************************************************************/
  53. __inline PDVA DVAOpenSurface(HDC hdc, int nSurface)
  54. {
  55. PDVA pdva;
  56. pdva = (PDVA)GlobalLock(GlobalAlloc(GHND|GMEM_SHARE, sizeof(DVASURFACEINFO)));
  57. if (pdva == NULL)
  58. return NULL;
  59. if (!DVAGetSurface(hdc, nSurface, pdva) ||
  60. !pdva->OpenSurface(pdva->lpSurface))
  61. {
  62. GlobalFree((HGLOBAL)SELECTOROF(pdva));
  63. return NULL;
  64. }
  65. return pdva;
  66. }
  67. /****************************************************************************
  68. ***************************************************************************/
  69. __inline void DVACloseSurface(PDVA pdva)
  70. {
  71. if (pdva == NULL)
  72. return;
  73. pdva->CloseSurface(pdva->lpSurface);
  74. GlobalFree((HGLOBAL)SELECTOROF(pdva));
  75. }
  76. /****************************************************************************
  77. ***************************************************************************/
  78. __inline BOOL DVABeginAccess(PDVA pdva, int x, int y, int dx, int dy)
  79. {
  80. return pdva->BeginAccess(pdva->lpSurface, x, y, dx, dy);
  81. }
  82. /****************************************************************************
  83. ***************************************************************************/
  84. __inline void DVAEndAccess(PDVA pdva)
  85. {
  86. pdva->EndAccess(pdva->lpSurface);
  87. }
  88. /****************************************************************************
  89. ***************************************************************************/
  90. __inline LPBITMAPINFOHEADER DVAGetSurfaceFmt(PDVA pdva)
  91. {
  92. if (pdva == NULL)
  93. return NULL;
  94. return &pdva->BitmapInfo;
  95. }
  96. /****************************************************************************
  97. ***************************************************************************/
  98. __inline LPVOID DVAGetSurfacePtr(PDVA pdva)
  99. {
  100. if (pdva == NULL)
  101. return NULL;
  102. return (LPVOID)MAKELONG(pdva->offSurface, pdva->selSurface);
  103. }
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif // _INC_DVA