- Timestamp:
- Nov 14, 2000, 3:28:22 PM (25 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibitmap.cpp
r4574 r4590 1 /* $Id: dibitmap.cpp,v 1.1 1 2000-11-09 18:16:56sandervl Exp $ */1 /* $Id: dibitmap.cpp,v 1.12 2000-11-14 14:28:22 sandervl Exp $ */ 2 2 3 3 /* … … 14 14 #include <stdarg.h> 15 15 #include <string.h> 16 #include "misc.h" 16 #include <misc.h> 17 #include <winuser32.h> 17 18 #include "dibsect.h" 18 19 19 #define DBG_LOCALLOG 20 #define DBG_LOCALLOG DBG_dibitmap 20 21 #include "dbglocal.h" 21 22 22 23 //****************************************************************************** 23 24 //****************************************************************************** 24 HBITMAP WIN32API CreateDIBitmap(HDC hdc, const BITMAPINFOHEADER *lpbmih, 25 DWORD fdwInit, const void *lpbInit, 25 HBITMAP WIN32API CreateDIBitmap(HDC hdc, const BITMAPINFOHEADER *lpbmih, 26 DWORD fdwInit, const void *lpbInit, 26 27 const BITMAPINFO *lpbmi, UINT fuUsage) 27 28 { … … 32 33 // to 8bpp by Open32) 33 34 if(lpbmih->biBitCount == 1) { 34 35 } 36 35 dprintf(("WARNING: CreateDIBitmap doesn't handle 1bpp bitmaps very well!!!!!")); 36 } 37 37 38 //TEMPORARY HACK TO PREVENT CRASH IN OPEN32 (WSeB GA) 38 39 … … 49 50 // however wants to copy it later on ... 50 51 int biBitCount = lpbmih->biBitCount; 51 52 52 53 if (lpbmih->biBitCount != lpbmi->bmiHeader.biBitCount) 53 54 { … … 55 56 lpbmih->biBitCount, 56 57 lpbmi->bmiHeader.biBitCount)); 57 58 58 59 ((BITMAPINFOHEADER *)lpbmih)->biBitCount = lpbmi->bmiHeader.biBitCount; 59 60 } … … 61 62 rc = O32_CreateDIBitmap(hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage); 62 63 63 dprintf(("GDI32: CreateDIBitmap %x %x %x %x returned %x ", hdc, fdwInit, lpbInit, fuUsage, rc));64 dprintf(("GDI32: CreateDIBitmap %x %x %x %x returned %x (%d,%d, bps %d)", hdc, fdwInit, lpbInit, fuUsage, rc, lpbmih->biWidth, lpbmih->biHeight, lpbmih->biBitCount)); 64 65 65 66 ((BITMAPINFOHEADER *)lpbmih)->biHeight = iHeight; … … 120 121 if(pbmi->bmiHeader.biWidth < 0) 121 122 { 122 123 124 123 dprintf(("CreateDIBSection: width %d", pbmi->bmiHeader.biWidth)); 124 pbmi->bmiHeader.biWidth = -pbmi->bmiHeader.biWidth; 125 fFlip = FLIP_HOR; 125 126 } 126 127 iHeight = pbmi->bmiHeader.biHeight; 127 128 if(pbmi->bmiHeader.biHeight < 0) 128 129 { 129 130 131 130 dprintf(("CreateDIBSection: height %d", pbmi->bmiHeader.biHeight)); 131 pbmi->bmiHeader.biHeight = -pbmi->bmiHeader.biHeight; 132 fFlip |= FLIP_VERT; 132 133 } 133 134 134 135 //SvL: RP7 (update) calls this api with hdc == 0 135 136 if(hdc == 0) { 136 137 137 hdc = GetWindowDC(GetDesktopWindow()); 138 fCreateDC = TRUE; 138 139 } 139 140 res = O32_CreateDIBitmap(hdc, &pbmi->bmiHeader, 0, NULL, pbmi, iUsage); … … 181 182 pbmi->bmiHeader.biHeight = iHeight; 182 183 183 if(fCreateDC) 184 if(fCreateDC) ReleaseDC(GetDesktopWindow(), hdc); 184 185 return(res); 185 186 } 186 187 } 187 if(fCreateDC) 188 if(fCreateDC) ReleaseDC(GetDesktopWindow(), hdc); 188 189 189 190 /* Error. */ … … 271 272 //****************************************************************************** 272 273 //****************************************************************************** 273 int WIN32API GetDIBits(HDC hdc, HBITMAP hBitmap, UINT uStartScan, UINT cScanLines, 274 int WIN32API GetDIBits(HDC hdc, HBITMAP hBitmap, UINT uStartScan, UINT cScanLines, 274 275 void *lpvBits, PBITMAPINFO lpbi, UINT uUsage) 275 276 { … … 289 290 ((DWORD*)(lpbi->bmiColors))[1] = 0x00FF00; 290 291 ((DWORD*)(lpbi->bmiColors))[2] = 0xFF0000; 291 break; 292 break; 292 293 } 293 294 … … 297 298 //****************************************************************************** 298 299 //****************************************************************************** 299 int WIN32API SetDIBits( HDC arg1, HBITMAP arg2, UINT arg3, UINT arg4, const VOID * arg5, const BITMAPINFO * arg6, UINT arg7) 300 { 301 dprintf(("GDI32: SetDIBits %x %x %x %x %x %x %x\n", arg1, arg2, arg3, arg4, arg5, arg6, arg7)); 302 303 if(DIBSection::getSection() != NULL) 300 int WIN32API SetDIBits(HDC hdc, HBITMAP hBitmap, UINT startscan, UINT numlines, const VOID *pBits, 301 const BITMAPINFO *pBitmapInfo, UINT usage) 302 { 303 dprintf(("GDI32: SetDIBits %x %x %x %x %x %x %x", hdc, hBitmap, startscan, numlines, pBits, pBitmapInfo, usage)); 304 305 if(DIBSection::getSection() != NULL) 304 306 { 305 307 DIBSection *dsect; 306 308 307 dsect = DIBSection::find((DWORD) arg2);309 dsect = DIBSection::find((DWORD)hBitmap); 308 310 if(dsect) { 309 return dsect->SetDIBits( arg1, arg2, arg3, arg4, arg5, (BITMAPINFOHEADER_W *)&arg6->bmiHeader, arg7);311 return dsect->SetDIBits(hdc, hBitmap, startscan, numlines, pBits, (BITMAPINFOHEADER_W *)&pBitmapInfo->bmiHeader, usage); 310 312 } 311 313 } 312 return O32_SetDIBits(arg1, arg2, arg3, arg4, arg5, arg6, arg7); 313 } 314 //****************************************************************************** 315 //****************************************************************************** 314 //SvL: Open32's SetDIBits really messes things up for 1 bpp bitmaps, must use SetBitmapBits 315 if(pBitmapInfo->bmiHeader.biBitCount == 1 && startscan == 0 && numlines == pBitmapInfo->bmiHeader.biHeight) 316 { 317 int linewidth = DIB_GetDIBWidthBytes(pBitmapInfo->bmiHeader.biWidth, 1); 318 char *newpix = (char *)malloc(linewidth*pBitmapInfo->bmiHeader.biHeight); 319 char *orgpix = (char *)pBits; 320 int ret; 321 322 newpix += ((pBitmapInfo->bmiHeader.biHeight-1)*linewidth); 323 324 //flip bitmap here; SetDIBits assumes origin is left bottom, SetBitmapBits left top 325 for(int i=0;i<pBitmapInfo->bmiHeader.biHeight;i++) { 326 memcpy(newpix, orgpix, linewidth); 327 newpix -= linewidth; 328 orgpix += linewidth; 329 } 330 newpix += linewidth; 331 ret = O32_SetBitmapBits(hBitmap, pBitmapInfo->bmiHeader.biSizeImage, newpix); 332 333 free(newpix); 334 return ret; 335 } 336 #ifdef DEBUG 337 if(pBitmapInfo->bmiHeader.biBitCount == 1) { 338 dprintf(("ERROR: SetDIBits does NOT work well for 1 bpp bitmaps!!!!!")); 339 } 340 #endif 341 return O32_SetDIBits(hdc, hBitmap, startscan, numlines, pBits, pBitmapInfo, usage); 342 } 343 //****************************************************************************** 344 //****************************************************************************** -
trunk/src/gdi32/gdi32.cpp
r4574 r4590 1 /* $Id: gdi32.cpp,v 1.6 0 2000-11-09 18:16:57sandervl Exp $ */1 /* $Id: gdi32.cpp,v 1.61 2000-11-14 14:28:22 sandervl Exp $ */ 2 2 3 3 /* … … 114 114 //****************************************************************************** 115 115 //****************************************************************************** 116 HBRUSH WIN32API CreateDIBPatternBrushPt( const VOID * arg1, UINT arg2)117 { 118 dprintf(("GDI32: CreateDIBPatternBrushPt \n"));119 return O32_CreateDIBPatternBrushPt( arg1, arg2);116 HBRUSH WIN32API CreateDIBPatternBrushPt( const VOID * buffer, UINT usage) 117 { 118 dprintf(("GDI32: CreateDIBPatternBrushPt %x %x", buffer, usage)); 119 return O32_CreateDIBPatternBrushPt(buffer, usage); 120 120 } 121 121 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.