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.

156 lines
4.0 KiB

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