Changeset 2718 for trunk/src/gdi32/dibsect.cpp
- Timestamp:
- Feb 10, 2000, 1:36:11 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibsect.cpp
r2706 r2718 1 /* $Id: dibsect.cpp,v 1.1 6 2000-02-09 23:34:30 sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.17 2000-02-10 00:36:10 sandervl Exp $ */ 2 2 3 3 /* … … 8 8 * 9 9 * Project Odin Software License can be found in LICENSE.TXT 10 * 11 * NOTE: 12 * This is not a complete solution for CreateDIBSection, but enough for Quake 2! 10 13 * 11 14 */ … … 21 24 #include <vmutex.h> 22 25 #include <winconst.h> 23 26 #include <win32wnd.h> 27 #include "oslibgpi.h" 28 29 //Win32 apis used: 24 30 HWND WIN32API WindowFromDC(HDC hdc); 25 HWND Win32ToOS2Handle(HWND hwnd); 26 27 BOOL APIENTRY _GpiEnableYInversion (HPS hps, LONG lHeight); 28 29 inline BOOL APIENTRY GpiEnableYInversion (HPS hps, LONG lHeight) 30 { 31 BOOL yyrc; 32 USHORT sel = RestoreOS2FS(); 33 34 yyrc = _GpiEnableYInversion(hps, lHeight); 35 SetFS(sel); 36 37 return yyrc; 38 } 31 BOOL WINAPI UnmapViewOfFile(LPVOID addr); 32 LPVOID WINAPI MapViewOfFile(HANDLE mapping, DWORD access, DWORD offset_high, 33 DWORD offset_low, DWORD count); 39 34 40 35 static VMutex dibMutex; 41 36 42 //NOTE: 43 //This is not a complete solution for CreateDIBSection, but enough for Quake 2! 44 //****************************************************************************** 45 //****************************************************************************** 46 DIBSection::DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD handle, int fFlip) 37 //****************************************************************************** 38 //****************************************************************************** 39 DIBSection::DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD hSection, DWORD dwOffset, DWORD handle, int fFlip) 47 40 : bmpBits(NULL), pOS2bmp(NULL), next(NULL) 48 41 { … … 82 75 } 83 76 84 bmpBits = (char *)malloc(bmpsize*pbmi->biHeight); 77 this->hSection = hSection; 78 if(hSection) { 79 bmpBits = (char *)MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS_W, 0, dwOffset, bmpsize*pbmi->biHeight); 80 if(!bmpBits) { 81 dprintf(("Dibsection: mapViewOfFile %x failed!", hSection)); 82 DebugInt3(); 83 } 84 } 85 if(!bmpBits) { 86 DosAllocMem((PPVOID)&bmpBits, bmpsize*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT); 87 } 85 88 memset(bmpBits, 0, bmpsize*pbmi->biHeight); 86 89 87 pOS2bmp 90 pOS2bmp = (BITMAPINFO2 *)malloc(os2bmpsize); 88 91 89 92 memset(pOS2bmp, /* set header + palette entries to zero */ … … 164 167 { 165 168 dprintf(("Delete DIBSection %x", handle)); 169 170 if(hSection) { 171 UnmapViewOfFile(bmpBits); 172 } 173 else 166 174 if(bmpBits) 167 free(bmpBits); 175 DosFreeMem(bmpBits); 176 168 177 if(pOS2bmp) 169 178 free(pOS2bmp);
Note:
See TracChangeset
for help on using the changeset viewer.