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.

110 lines
3.1 KiB

  1. /****************************************************************************
  2. DVA surface provider for a Viper VLB card.
  3. assumes a linear frame buffer
  4. assumes a hardware cursor
  5. ***************************************************************************/
  6. #include <windows.h>
  7. #include "dva.h"
  8. #include "lockbm.h"
  9. extern NEAR PASCAL DetectViper(void);
  10. /****************************************************************************
  11. ***************************************************************************/
  12. BOOL CALLBACK vlb_open_surface(LPVOID pv)
  13. {
  14. return TRUE;
  15. }
  16. /****************************************************************************
  17. ***************************************************************************/
  18. void CALLBACK vlb_close_surface(LPVOID pv)
  19. {
  20. }
  21. /****************************************************************************
  22. ***************************************************************************/
  23. BOOL CALLBACK vlb_begin_access(LPVOID pv, int x, int y, int dx, int dy)
  24. {
  25. //
  26. // VIPER has a HW cursor so we dont do anything
  27. // !!!we may need to check for the sysVM in background
  28. //
  29. return TRUE;
  30. }
  31. /****************************************************************************
  32. ***************************************************************************/
  33. void CALLBACK vlb_end_access(LPVOID pv)
  34. {
  35. }
  36. /****************************************************************************
  37. ***************************************************************************/
  38. BOOL vlb_get_surface(HDC hdc, int nSurface, DVASURFACEINFO FAR *pdva)
  39. {
  40. DWORD SizeImage;
  41. IBITMAP FAR *pbm;
  42. UINT sel;
  43. DWORD off;
  44. LPBITMAPINFOHEADER lpbi;
  45. if (nSurface != 0)
  46. return FALSE;
  47. pbm = GetPDevice(hdc);
  48. if (pbm == NULL || pbm->bmType == 0)
  49. return FALSE;
  50. // if (pbm->bmType != 0x2000)
  51. // return FALSE;
  52. if (!DetectViper())
  53. return FALSE;
  54. sel = ((WORD FAR *)&pbm->bmBits)[1];
  55. off = ((WORD FAR *)&pbm->bmBits)[0];
  56. SizeImage = (DWORD)(UINT)pbm->bmWidthBytes * (DWORD)(UINT)pbm->bmHeight;
  57. if (GetSelectorLimit(sel) != 0x1FFFFF)
  58. return FALSE;
  59. lpbi = &pdva->BitmapInfo;
  60. lpbi->biSize = sizeof(BITMAPINFOHEADER);
  61. lpbi->biWidth = pbm->bmWidthBytes*8/pbm->bmBitsPixel;
  62. lpbi->biHeight = -(int)pbm->bmHeight;
  63. lpbi->biPlanes = pbm->bmPlanes;
  64. lpbi->biBitCount = pbm->bmBitsPixel;
  65. lpbi->biCompression = 0;
  66. lpbi->biSizeImage = SizeImage;
  67. lpbi->biXPelsPerMeter = pbm->bmWidthBytes;
  68. lpbi->biYPelsPerMeter = 0;
  69. lpbi->biClrUsed = 0;
  70. lpbi->biClrImportant = 0;
  71. pdva->selSurface = sel;
  72. pdva->offSurface = off;
  73. pdva->Version = 0x0100;
  74. pdva->Flags = 0;
  75. pdva->lpSurface = 0;
  76. (FARPROC)pdva->OpenSurface = (FARPROC)vlb_open_surface;
  77. (FARPROC)pdva->CloseSurface = (FARPROC)vlb_close_surface;
  78. (FARPROC)pdva->BeginAccess = (FARPROC)vlb_begin_access;
  79. (FARPROC)pdva->EndAccess = (FARPROC)vlb_end_access;
  80. (FARPROC)pdva->ShowSurface = (FARPROC)NULL;
  81. return TRUE;
  82. }