- Timestamp:
- Nov 13, 2001, 2:18:22 PM (24 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r6692 r7327 1 /* $Id: blit.cpp,v 1.3 4 2001-09-10 11:02:40sandervl Exp $ */1 /* $Id: blit.cpp,v 1.35 2001-11-13 13:18:22 sandervl Exp $ */ 2 2 3 3 /* … … 147 147 bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 2) : 0x001f; 148 148 break; 149 150 case 24: 149 151 case 32: 150 152 bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors : 0xff0000; … … 226 228 const BITMAPINFO *info, UINT coloruse) 227 229 { 230 static BOOL fMatrox32BppBug = FALSE; 231 INT rc = 0; 232 char *newBits = NULL; 233 234 //If upside down, reverse scanlines and call SetDIBitsToDevice again 228 235 if(info->bmiHeader.biHeight < 0 && info->bmiHeader.biBitCount != 8 && info->bmiHeader.biCompression == 0) { 229 236 // upside down 230 INT rc = 0;237 INT rc = -1; 231 238 BITMAPINFO newInfo; 232 239 newInfo.bmiHeader = info->bmiHeader; … … 244 251 pbSrc -= lLineByte; 245 252 } 246 rc = SetDIBitsToDevice _( hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (void *)newBits, &newInfo, DIB_RGB_COLORS);253 rc = SetDIBitsToDevice( hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (void *)newBits, &newInfo, coloruse ); 247 254 free( newBits ); 248 255 } 256 else DebugInt3(); 257 249 258 return rc; 250 259 } 260 261 //We must convert 32 bpp bitmap data to 24 bpp on systems with the Matrox 262 //display driver. (GpiDrawBits for 32 bpp fails with insufficient memory error) 263 if(info->bmiHeader.biBitCount == 32 && fMatrox32BppBug) 264 { 265 BITMAPINFO newInfo; 266 newInfo.bmiHeader = info->bmiHeader; 267 268 long lLineWidth; 269 long lHeight = (newInfo.bmiHeader.biHeight > 0) ? newInfo.bmiHeader.biHeight : -newInfo.bmiHeader.biHeight; 270 long lWidth = newInfo.bmiHeader.biWidth; 271 272 newInfo.bmiHeader.biBitCount = 24; 273 newInfo.bmiHeader.biSizeImage = CalcBitmapSize(24, newInfo.bmiHeader.biWidth, 274 newInfo.bmiHeader.biHeight); 275 276 lLineWidth = newInfo.bmiHeader.biSizeImage / lHeight; 277 278 //convert 32 bits bitmap data to 24 bits 279 newBits = (char *)malloc(newInfo.bmiHeader.biSizeImage+16); //extra room needed for copying (too much) 280 if(!newBits) { 281 DebugInt3(); 282 return -1; 283 } 284 unsigned char *pbSrc = (unsigned char *)bits; 285 unsigned char *pbDst = (unsigned char *)newBits; 286 //not very efficient 287 for(int i = 0; i < lHeight; i++) { 288 for(int j=0;j<lWidth;j++) { 289 *(DWORD *)pbDst = *(DWORD *)pbSrc; 290 pbSrc += 4; 291 pbDst += 3; 292 } 293 //24 bpp scanline must be aligned at 4 byte boundary 294 pbDst += (lLineWidth - 3*lWidth); 295 } 296 rc = SetDIBitsToDevice_( hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, newBits, &newInfo, coloruse ); 297 free(newBits); 298 return rc; 299 } 300 rc = SetDIBitsToDevice_( hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, bits, info, coloruse ); 301 302 if(rc == -1 && info->bmiHeader.biBitCount == 32 && !fMatrox32BppBug) 303 { 304 //The Matrox driver seems to have some difficulty blitting 32bpp 305 //data. (out of memory error) The same operation works fine with SDD. 306 fMatrox32BppBug = TRUE; 307 return SetDIBitsToDevice(hdc, xDest, yDest, cx, 308 cy, xSrc, ySrc, 309 startscan, lines, bits, 310 info, coloruse); 311 } 312 return rc; 313 251 314 //SvL: Breaks startup bitmap of Acrobat Reader 4.05 252 315 #if 0 … … 319 382 } 320 383 #endif 321 else {322 return SetDIBitsToDevice_( hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, bits, info, coloruse );323 }324 384 } 325 385 //****************************************************************************** … … 441 501 bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 2) : 0x001f; 442 502 break; 503 case 24: 443 504 case 32: 444 505 bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors : 0xff0000; … … 470 531 ((BITMAPINFO *)info)->bmiHeader.biCompression = 0; 471 532 compression = BI_BITFIELDS; 472 473 533 } 474 534 … … 629 689 630 690 case 32: 631 return cx*cy ;691 return cx*cy*4; 632 692 633 693 default: -
trunk/src/gdi32/dibitmap.cpp
r6603 r7327 1 /* $Id: dibitmap.cpp,v 1.2 7 2001-08-28 18:58:57sandervl Exp $ */1 /* $Id: dibitmap.cpp,v 1.28 2001-11-13 13:18:22 sandervl Exp $ */ 2 2 3 3 /* … … 96 96 bitfields[2] = (lpbmih->biCompression == BI_BITFIELDS) ? *((DWORD *)lpbmi->bmiColors + 2) : 0x001f; 97 97 break; 98 case 24: 98 99 case 32: 99 bitfields[0] = (lpbmih->biCompression == BI_BITFIELDS) ? *(DWORD *)lpbmi->bmiColors : 0xff0000;100 bitfields[0] = (lpbmih->biCompression == BI_BITFIELDS) ? *(DWORD *)lpbmi->bmiColors : 0xff0000; 100 101 bitfields[1] = (lpbmih->biCompression == BI_BITFIELDS) ? *((DWORD *)lpbmi->bmiColors + 1) : 0xff00; 101 102 bitfields[2] = (lpbmih->biCompression == BI_BITFIELDS) ? *((DWORD *)lpbmi->bmiColors + 2) : 0xff; … … 361 362 case 24: 362 363 case 32: 363 ((DWORD*)(lpbi->bmiColors))[0] = 0x 0000FF;364 ((DWORD*)(lpbi->bmiColors))[0] = 0xFF0000; 364 365 ((DWORD*)(lpbi->bmiColors))[1] = 0x00FF00; 365 ((DWORD*)(lpbi->bmiColors))[2] = 0x FF0000;366 ((DWORD*)(lpbi->bmiColors))[2] = 0x0000FF; 366 367 break; 367 368 } … … 448 449 bitfields[2] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)pBitmapInfo->bmiColors + 2) : 0x001f; 449 450 break; 451 452 case 24: 450 453 case 32: 451 454 bitfields[0] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)pBitmapInfo->bmiColors : 0xff0000; -
trunk/src/gdi32/dibsect.cpp
r7113 r7327 1 /* $Id: dibsect.cpp,v 1.5 8 2001-10-18 17:01:34sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.59 2001-11-13 13:18:22 sandervl Exp $ */ 2 2 3 3 /* … … 157 157 158 158 case 24: 159 dibinfo.dsBitfields[0] = 0xff;160 dibinfo.dsBitfields[1] = 0xff00;161 dibinfo.dsBitfields[2] = 0xff0000;162 break;163 164 159 case 32: 165 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS_W) ? *(DWORD *)pColors : 0xff;166 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS_W) ? *((DWORD *)pColors + 1) : 0x ff00;167 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS_W) ? *((DWORD *)pColors + 2) : 0x ff0000;168 if(dibinfo.dsBitfields[0] != 0xff && dibinfo.dsBitfields[1] != 0xff00 && dibinfo.dsBitfields[2] != 0xff0000) {160 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS_W) ? *(DWORD *)pColors : 0xff0000; 161 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS_W) ? *((DWORD *)pColors + 1) : 0x00ff00; 162 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS_W) ? *((DWORD *)pColors + 2) : 0x0000ff; 163 if(dibinfo.dsBitfields[0] != 0xff0000 && dibinfo.dsBitfields[1] != 0xff00 && dibinfo.dsBitfields[2] != 0xff) { 169 164 dprintf(("DIBSection: unsupported bitfields for 32 bits bitmap!!")); 170 165 } … … 336 331 337 332 case 24: 338 dibinfo.dsBitfields[0] = 0xff;339 dibinfo.dsBitfields[1] = 0xff00;340 dibinfo.dsBitfields[2] = 0xff0000;341 break;342 343 333 case 32: 344 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS_W) ? *(DWORD *)pColors : 0xff;345 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS_W) ? *((DWORD *)pColors + 1) : 0x ff00;346 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS_W) ? *((DWORD *)pColors + 2) : 0x ff0000;347 if(dibinfo.dsBitfields[0] != 0xff && dibinfo.dsBitfields[1] != 0xff00 && dibinfo.dsBitfields[2] != 0xff0000) {334 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS_W) ? *(DWORD *)pColors : 0xff0000; 335 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS_W) ? *((DWORD *)pColors + 1) : 0x00ff00; 336 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS_W) ? *((DWORD *)pColors + 2) : 0x0000ff; 337 if(dibinfo.dsBitfields[0] != 0xff0000 && dibinfo.dsBitfields[1] != 0xff00 && dibinfo.dsBitfields[2] != 0xff) { 348 338 dprintf(("DIBSection: unsupported bitfields for 32 bits bitmap!!")); 349 339 }
Note:
See TracChangeset
for help on using the changeset viewer.