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.

129 lines
3.5 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. extern BOOL WINAPI DVAGetSurface(HDC hdc, int nSurface, DVASURFACEINFO FAR *lpSurfaceInfo);
  36. /****************************************************************************
  37. ***************************************************************************/
  38. __inline PDVA DVAOpenSurface(HDC hdc, int nSurface)
  39. {
  40. PDVA pdva;
  41. pdva = (PDVA)GlobalLock(GlobalAlloc(GHND|GMEM_SHARE, sizeof(DVASURFACEINFO)));
  42. if (pdva == NULL)
  43. return NULL;
  44. if (!DVAGetSurface(hdc, nSurface, pdva) ||
  45. !pdva->OpenSurface(pdva->lpSurface))
  46. {
  47. GlobalFree((HGLOBAL)SELECTOROF(pdva));
  48. return NULL;
  49. }
  50. return pdva;
  51. }
  52. /****************************************************************************
  53. ***************************************************************************/
  54. __inline void DVACloseSurface(PDVA pdva)
  55. {
  56. if (pdva == NULL)
  57. return;
  58. pdva->CloseSurface(pdva->lpSurface);
  59. GlobalFree((HGLOBAL)SELECTOROF(pdva));
  60. }
  61. /****************************************************************************
  62. ***************************************************************************/
  63. __inline BOOL DVABeginAccess(PDVA pdva, int x, int y, int dx, int dy)
  64. {
  65. return pdva->BeginAccess(pdva->lpSurface, x, y, dx, dy);
  66. }
  67. /****************************************************************************
  68. ***************************************************************************/
  69. __inline void DVAEndAccess(PDVA pdva)
  70. {
  71. pdva->EndAccess(pdva->lpSurface);
  72. }
  73. /****************************************************************************
  74. ***************************************************************************/
  75. __inline LPBITMAPINFOHEADER DVAGetSurfaceFmt(PDVA pdva)
  76. {
  77. if (pdva == NULL)
  78. return NULL;
  79. return &pdva->BitmapInfo;
  80. }
  81. /****************************************************************************
  82. ***************************************************************************/
  83. __inline LPVOID DVAGetSurfacePtr(PDVA pdva)
  84. {
  85. if (pdva == NULL)
  86. return NULL;
  87. return (LPVOID)MAKELONG(pdva->offSurface, pdva->selSurface);
  88. }
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif // _INC_DVA