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.

69 lines
2.2 KiB

  1. /****************************************************************************
  2. ***************************************************************************/
  3. #include <windows.h>
  4. #include "dva.h"
  5. #include "lockbm.h"
  6. extern BOOL FAR PASCAL _loadds vga_open_surface(LPVOID pv);
  7. extern void FAR PASCAL _loadds vga_close_surface(LPVOID pv);
  8. extern BOOL FAR PASCAL _loadds vga_begin_access(LPVOID pv, int x, int y, int dx, int dy);
  9. extern void FAR PASCAL _loadds vga_end_access(LPVOID pv);
  10. /****************************************************************************
  11. ***************************************************************************/
  12. BOOL thun_get_surface(HDC hdc, int nSurface, DVASURFACEINFO FAR *pdva)
  13. {
  14. DWORD SizeImage;
  15. IBITMAP FAR *pbm;
  16. UINT sel;
  17. DWORD off;
  18. LPBITMAPINFOHEADER lpbi;
  19. if (nSurface != 0)
  20. return FALSE;
  21. pbm = GetPDevice(hdc);
  22. if (pbm == NULL || pbm->bmType == 0)
  23. return FALSE;
  24. if (pbm->bmType != 0xFFFF)
  25. return FALSE;
  26. sel = ((WORD FAR *)&pbm->bmBits)[1];
  27. off = ((WORD FAR *)&pbm->bmBits)[0];
  28. SizeImage = (DWORD)(UINT)pbm->bmWidthBytes * (DWORD)(UINT)pbm->bmHeight;
  29. if (GetSelectorLimit(sel) != 0x3FFFFF)
  30. return FALSE;
  31. lpbi = &pdva->BitmapInfo;
  32. lpbi->biSize = sizeof(BITMAPINFOHEADER);
  33. lpbi->biWidth = pbm->bmWidthBytes/(pbm->bmBitsPixel/8);
  34. lpbi->biHeight = -(int)pbm->bmHeight;
  35. lpbi->biPlanes = pbm->bmPlanes;
  36. lpbi->biBitCount = pbm->bmBitsPixel;
  37. lpbi->biCompression = 0;
  38. lpbi->biSizeImage = SizeImage;
  39. lpbi->biXPelsPerMeter = pbm->bmWidthBytes;
  40. lpbi->biYPelsPerMeter = 0;
  41. lpbi->biClrUsed = 0;
  42. lpbi->biClrImportant = 0;
  43. pdva->selSurface = sel;
  44. pdva->offSurface = off;
  45. pdva->Version = 0x0100;
  46. pdva->Flags = 0;
  47. pdva->lpSurface = 0;
  48. (FARPROC)pdva->OpenSurface = (FARPROC)vga_open_surface;
  49. (FARPROC)pdva->CloseSurface = (FARPROC)vga_close_surface;
  50. (FARPROC)pdva->BeginAccess = (FARPROC)vga_begin_access;
  51. (FARPROC)pdva->EndAccess = (FARPROC)vga_end_access;
  52. (FARPROC)pdva->ShowSurface = (FARPROC)NULL;
  53. return TRUE;
  54. }