- Timestamp:
- Feb 3, 2000, 12:45:07 AM (26 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r2592 r2600 1 /* $Id: blit.cpp,v 1. 1 2000-02-01 12:53:29sandervl Exp $ */1 /* $Id: blit.cpp,v 1.2 2000-02-02 23:45:06 sandervl Exp $ */ 2 2 3 3 /* … … 71 71 } 72 72 } 73 return rc; 73 74 } 74 75 } … … 85 86 INT result, imgsize, palsize, height, width; 86 87 char *ptr; 88 ULONG compression = 0; 89 WORD *newbits = 0; 87 90 88 91 SetLastError(0); … … 126 129 127 130 //SvL: Ignore BI_BITFIELDS type (SetDIBitsToDevice fails otherwise) 128 if(info->bmiHeader.biCompression == BI_BITFIELDS) 131 if(info->bmiHeader.biCompression == BI_BITFIELDS) { 132 DWORD *bitfields = (DWORD *)info->bmiColors; 133 134 dprintf(("BI_BITFIELDS compression %x %x %x", *bitfields, *(bitfields+1), *(bitfields+2))); 129 135 ((BITMAPINFO *)info)->bmiHeader.biCompression = 0; 136 compression = BI_BITFIELDS; 137 if(*(bitfields+1) == 0x3E0) {//RGB 555? 138 WORD *dstbits, *srcbits; 139 WORD pixel; 140 141 newbits = dstbits = (WORD *)malloc(imgsize); 142 srcbits = (WORD *)bits; 143 for(int i=0;i<imgsize/sizeof(WORD);i++) { 144 pixel = *dstbits = *srcbits++; 145 *dstbits &= 0x1F; 146 pixel &= 0x7FE0; 147 pixel <<= 1; 148 *dstbits = *dstbits | pixel; 149 dstbits++; 150 } 151 bits = newbits; 152 } 153 } 154 130 155 if(info->bmiHeader.biHeight < 0) 131 156 ((BITMAPINFO *)info)->bmiHeader.biHeight = -info->bmiHeader.biHeight; 132 157 133 // result = OSLibSetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (WINBITMAPINFOHEADER *)info, coloruse);134 // result = 1;135 158 result = O32_SetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (PBITMAPINFO)info, coloruse); 136 159 //SvL: Wrong Open32 return value … … 141 164 dprintf(("GDI32: SetDIBitsToDevice %d %d %d %d %x %d", info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biPlanes, info->bmiHeader.biBitCount, info->bmiHeader.biCompression, info->bmiHeader.biSizeImage)); 142 165 166 if(compression == BI_BITFIELDS) { 167 ((BITMAPINFO *)info)->bmiHeader.biCompression = BI_BITFIELDS; 168 if(newbits) free(newbits); 169 } 143 170 return result; 144 171 -
trunk/src/gdi32/dibitmap.cpp
r2592 r2600 1 /* $Id: dibitmap.cpp,v 1. 1 2000-02-01 12:53:29sandervl Exp $ */1 /* $Id: dibitmap.cpp,v 1.2 2000-02-02 23:45:06 sandervl Exp $ */ 2 2 3 3 /* … … 82 82 HBITMAP res = 0; 83 83 BOOL fFlip = 0; 84 int iHeight, iWidth;84 int iHeight, iWidth; 85 85 86 86 dprintf(("GDI32: CreateDIBSection %x %x %x %x %d", hdc, iUsage, ppvBits, hSection, dwOffset)); … … 110 110 if (res) 111 111 { 112 ULONG Pal[256];113 112 char PalSize; 114 LOGPALETTE tmpPal = { 0x300,1,{0,0,0,0}}; 115 HPALETTE hpalCur, hpalTmp; 116 DIBSection *dsect = new DIBSection((WINBITMAPINFOHEADER *)&pbmi->bmiHeader, iUsage, (DWORD)res, fFlip); 117 118 if(NULL!=dsect) 113 DIBSection *dsect = new DIBSection((BITMAPINFOHEADER_W *)&pbmi->bmiHeader, (char *)&pbmi->bmiColors, iUsage, (DWORD)res, fFlip); 114 115 if(dsect != NULL) 119 116 { 120 117 PalSize = dsect->GetBitCount(); 121 if(PalSize <=8)118 if(PalSize <= 8) 122 119 { 120 ULONG Pal[256]; 121 LOGPALETTE tmpPal = { 0x300,1,{0,0,0,0}}; 122 HPALETTE hpalCur, hpalTmp; 123 123 124 // Now get the current Palette from the DC 124 125 hpalTmp = CreatePalette(&tmpPal); … … 170 171 RGBQUAD *pColors) 171 172 { 172 HPALETTE hpal = O32_GetCurrentObject(hdc, OBJ_PAL);173 HPALETTE hpal = GetCurrentObject(hdc, OBJ_PAL); 173 174 UINT rc; 174 175 int i; … … 208 209 //****************************************************************************** 209 210 //****************************************************************************** 210 LONG WIN32API GetBitmapBits( HBITMAP arg1, LONG arg2, PVOID arg3)211 { 212 dprintf(("GDI32: GetBitmapBits "));213 return O32_GetBitmapBits( arg1, arg2, arg3);214 } 215 //****************************************************************************** 216 //****************************************************************************** 217 LONG WIN32API SetBitmapBits( HBITMAP arg1, LONG arg2, const VOID * arg3)218 { 219 dprintf(("GDI32: SetBitmapBits "));220 return O32_SetBitmapBits( arg1, (DWORD)arg2, arg3);221 } 222 //****************************************************************************** 223 //****************************************************************************** 224 BOOL WIN32API GetBitmapDimensionEx( HBITMAP arg1, PSIZE arg2)225 { 226 dprintf(("GDI32: GetBitmapDimensionEx "));227 return O32_GetBitmapDimensionEx( arg1, arg2);211 LONG WIN32API GetBitmapBits( HBITMAP hBitmap, LONG arg2, PVOID arg3) 212 { 213 dprintf(("GDI32: GetBitmapBits %x", hBitmap)); 214 return O32_GetBitmapBits(hBitmap, arg2, arg3); 215 } 216 //****************************************************************************** 217 //****************************************************************************** 218 LONG WIN32API SetBitmapBits( HBITMAP hBitmap, LONG arg2, const VOID * arg3) 219 { 220 dprintf(("GDI32: SetBitmapBits %x", hBitmap)); 221 return O32_SetBitmapBits(hBitmap, (DWORD)arg2, arg3); 222 } 223 //****************************************************************************** 224 //****************************************************************************** 225 BOOL WIN32API GetBitmapDimensionEx( HBITMAP hBitmap, PSIZE pSize) 226 { 227 dprintf(("GDI32: GetBitmapDimensionEx %x (%d,%d)", hBitmap, pSize->cx, pSize->cy)); 228 return O32_GetBitmapDimensionEx(hBitmap, pSize); 228 229 } 229 230 //****************************************************************************** … … 251 252 dprintf(("GDI32: SetDIBits %x %x %x %x %x %x %x\n", arg1, arg2, arg3, arg4, arg5, arg6, arg7)); 252 253 253 if(DIBSection::getSection() != NULL) { 254 if(DIBSection::getSection() != NULL) 255 { 254 256 DIBSection *dsect; 255 257 256 258 dsect = DIBSection::find((DWORD)arg2); 257 259 if(dsect) { 258 return dsect->SetDIBits(arg1, arg2, arg3, arg4, arg5, ( WINBITMAPINFOHEADER*)&arg6->bmiHeader, arg7);260 return dsect->SetDIBits(arg1, arg2, arg3, arg4, arg5, (BITMAPINFOHEADER_W *)&arg6->bmiHeader, arg7); 259 261 } 260 262 } -
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; -
trunk/src/gdi32/dibsect.h
r2592 r2600 1 /* $Id: dibsect.h,v 1.1 0 2000-02-01 12:53:29sandervl Exp $ */1 /* $Id: dibsect.h,v 1.11 2000-02-02 23:45:06 sandervl Exp $ */ 2 2 3 3 /* … … 36 36 DWORD biClrUsed; 37 37 DWORD biClrImportant; 38 } WINBITMAPINFOHEADER;38 } BITMAPINFOHEADER_W; 39 39 40 40 typedef struct … … 47 47 WORD bmBitsPixel; 48 48 LPVOID bmBits; 49 } WINBITMAP, *LPWINBITMAP;49 } BITMAP_W, *LPBITMAP_W; 50 50 51 51 #ifdef OS2_ONLY 52 52 typedef struct 53 53 { 54 WINBITMAPdsBm;55 WINBITMAPINFOHEADERdsBmih;54 BITMAP_W dsBm; 55 BITMAPINFOHEADER_W dsBmih; 56 56 DWORD dsBitfields[3]; 57 57 HANDLE dshSection; … … 63 63 { 64 64 public: 65 DIBSection( WINBITMAPINFOHEADER *pbmi, DWORD iUsage, DWORD handle, int fFlip);65 DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD handle, int fFlip); 66 66 ~DIBSection(); 67 67 … … 83 83 84 84 int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT 85 lines, const VOID *bits, WINBITMAPINFOHEADER*pbmi,85 lines, const VOID *bits, BITMAPINFOHEADER_W *pbmi, 86 86 UINT coloruse); 87 87 … … 101 101 BOOL fFlip; 102 102 int bmpsize; 103 DIBSECTION dibinfo; 104 103 105 BITMAPINFO2 *pOS2bmp; 104 106 // Linked list management -
trunk/src/gdi32/gdi32.cpp
r2592 r2600 1 /* $Id: gdi32.cpp,v 1.3 7 2000-02-01 12:53:30sandervl Exp $ */1 /* $Id: gdi32.cpp,v 1.38 2000-02-02 23:45:06 sandervl Exp $ */ 2 2 3 3 /* … … 777 777 if(nIndex == NUMCOLORS && rc > 256) 778 778 return -1; 779 779 780 return(rc); 780 781 } -
trunk/src/gdi32/oslibgdi.cpp
r2592 r2600 1 /* $Id: oslibgdi.cpp,v 1. 4 2000-02-01 12:53:30sandervl Exp $ */1 /* $Id: oslibgdi.cpp,v 1.5 2000-02-02 23:45:07 sandervl Exp $ */ 2 2 3 3 /* … … 24 24 INT OSLibSetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy, 25 25 INT xSrc, INT ySrc, UINT startscan, UINT lines, 26 LPCVOID bits, WINBITMAPINFOHEADER*info,26 LPCVOID bits, BITMAPINFOHEADER_W *info, 27 27 UINT coloruse) 28 28 { -
trunk/src/gdi32/oslibgdi.h
r2049 r2600 1 /* $Id: oslibgdi.h,v 1. 2 1999-12-09 16:49:45 cbratschiExp $ */1 /* $Id: oslibgdi.h,v 1.3 2000-02-02 23:45:07 sandervl Exp $ */ 2 2 3 3 /* … … 14 14 INT OSLibSetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy, 15 15 INT xSrc, INT ySrc, UINT startscan, UINT lines, 16 LPCVOID bits, WINBITMAPINFOHEADER*info,16 LPCVOID bits, BITMAPINFOHEADER_W *info, 17 17 UINT coloruse); 18 18
Note:
See TracChangeset
for help on using the changeset viewer.