Changeset 2600 for trunk/src/gdi32/dibsect.cpp
- Timestamp:
- Feb 3, 2000, 12:45:07 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibsect.cpp
r2592 r2600 1 /* $Id: dibsect.cpp,v 1.1 4 2000-02-01 12:53:29sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.15 2000-02-02 23:45:06 sandervl Exp $ */ 2 2 3 3 /* … … 15 15 #include <stdlib.h> 16 16 #include <string.h> 17 #include "win32type.h"18 #include "misc.h"17 #include <win32type.h> 18 #include <misc.h> 19 19 #define OS2_ONLY 20 20 #include "dibsect.h" 21 21 #include <vmutex.h> 22 #include <winconst.h> 22 23 23 24 HWND WIN32API WindowFromDC(HDC hdc); … … 43 44 //****************************************************************************** 44 45 //****************************************************************************** 45 DIBSection::DIBSection( WINBITMAPINFOHEADER *pbmi, DWORD iUsage, DWORD handle, int fFlip)46 DIBSection::DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD handle, int fFlip) 46 47 : bmpBits(NULL), pOS2bmp(NULL), next(NULL) 47 48 { … … 97 98 pOS2bmp->ulCompression = pbmi->biCompression; 98 99 //SvL: Ignore BI_BITFIELDS type (GpiDrawBits fails otherwise) 99 if(pOS2bmp->ulCompression == 3) {100 if(pOS2bmp->ulCompression == BI_BITFIELDS) { 100 101 pOS2bmp->ulCompression = 0; 101 102 } … … 110 111 dprintf(("Bits at %x, size %d",bmpBits, bmpsize*pbmi->biHeight)); 111 112 113 // clear DIBSECTION structure 114 memset(&dibinfo, 0, sizeof(dibinfo)); 115 116 // copy BITMAPINFOHEADER data into DIBSECTION structure 117 memcpy(&dibinfo.dsBmih, pbmi, sizeof(*pbmi)); 118 dibinfo.dsBm.bmType = 0; 119 dibinfo.dsBm.bmWidth = pbmi->biWidth; 120 dibinfo.dsBm.bmHeight = pbmi->biHeight; 121 dibinfo.dsBm.bmWidthBytes= bmpsize; 122 dibinfo.dsBm.bmPlanes = pbmi->biPlanes; 123 dibinfo.dsBm.bmBitsPixel = pbmi->biBitCount; 124 dibinfo.dsBm.bmBits = bmpBits; 125 126 dibinfo.dshSection = handle; 127 dibinfo.dsOffset = 0; // TODO: put the correct value here (if createdibsection with file handle) 128 129 if(pbmi->biCompression == BI_BITFIELDS) { 130 dibinfo.dsBitfields[0] = *((DWORD *)pColors); 131 dibinfo.dsBitfields[1] = *((DWORD *)pColors+1); 132 dibinfo.dsBitfields[2] = *((DWORD *)pColors+2); 133 dprintf(("BI_BITFIELDS %x %x %x", dibinfo.dsBitfields[0], dibinfo.dsBitfields[1], dibinfo.dsBitfields[2])); 134 } 135 112 136 this->handle = handle; 113 137 this->iUsage = iUsage; … … 165 189 //****************************************************************************** 166 190 int DIBSection::SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT 167 lines, const VOID *bits, WINBITMAPINFOHEADER*pbmi,191 lines, const VOID *bits, BITMAPINFOHEADER_W *pbmi, 168 192 UINT coloruse) 169 193 { … … 383 407 { 384 408 DIBSECTION *pDIBSection = (DIBSECTION *)lpBuffer; 385 LP WINBITMAP dsBm = (LPWINBITMAP)lpBuffer;409 LPBITMAP_W dsBm = (LPBITMAP_W)lpBuffer; 386 410 387 411 dprintf2(("GetDIBSection %x %d %x", handle, iSize, lpBuffer)); 388 412 if(iSize == sizeof(DIBSECTION)) 389 413 { 390 // BITMAP struct 391 pDIBSection->dsBm.bmType = 0; // TODO: put the correct value here 392 pDIBSection->dsBm.bmWidth = pOS2bmp->cx; 393 pDIBSection->dsBm.bmHeight = pOS2bmp->cy; 394 pDIBSection->dsBm.bmWidthBytes = bmpsize; 395 pDIBSection->dsBm.bmPlanes = pOS2bmp->cPlanes; 396 pDIBSection->dsBm.bmBitsPixel = pOS2bmp->cBitCount; 397 pDIBSection->dsBm.bmBits = bmpBits; 398 // BITMAPINFOHEADER data 399 pDIBSection->dsBmih.biSize = sizeof(BITMAPINFOHEADER); 400 pDIBSection->dsBmih.biWidth = pOS2bmp->cx; 401 pDIBSection->dsBmih.biHeight = pOS2bmp->cy; 402 pDIBSection->dsBmih.biPlanes = pOS2bmp->cPlanes; 403 pDIBSection->dsBmih.biBitCount = pOS2bmp->cBitCount; 404 pDIBSection->dsBmih.biCompression = pOS2bmp->ulCompression; 405 pDIBSection->dsBmih.biSizeImage = pOS2bmp->cbImage; 406 pDIBSection->dsBmih.biXPelsPerMeter = 0; // TODO: put the correct value here 407 pDIBSection->dsBmih.biYPelsPerMeter = 0; 408 pDIBSection->dsBmih.biClrUsed = (1<< pOS2bmp->cBitCount); 409 pDIBSection->dsBmih.biClrImportant = 0; 410 411 pDIBSection->dsBitfields[0] = 0; // TODO: put the correct value here 412 pDIBSection->dsBitfields[1] = 0; 413 pDIBSection->dsBitfields[2] = 0; 414 415 pDIBSection->dshSection = this->handle; 416 417 pDIBSection->dsOffset = 0; // TODO: put the correct value here 418 419 return sizeof(DIBSECTION); 414 memcpy(pDIBSection, &dibinfo, sizeof(dibinfo)); 415 return sizeof(DIBSECTION); 420 416 } 421 417 else 422 if(iSize == sizeof(WINBITMAP)) 423 { 424 dsBm->bmType = 0; // TODO: put the correct value here 425 dsBm->bmWidth = pOS2bmp->cx; 426 dsBm->bmHeight = pOS2bmp->cy; 427 dsBm->bmWidthBytes = bmpsize; 428 dsBm->bmPlanes = pOS2bmp->cPlanes; 429 dsBm->bmBitsPixel = pOS2bmp->cBitCount; 430 dsBm->bmBits = bmpBits; 431 return sizeof(WINBITMAP); 418 if(iSize == sizeof(BITMAP_W)) 419 { 420 memcpy(dsBm, &dibinfo.dsBm, sizeof(dibinfo.dsBm)); 421 return sizeof(BITMAP_W); 432 422 } 433 423 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.