Changeset 2602 for trunk/src/gdi32/blit.cpp
- Timestamp:
- Feb 3, 2000, 11:23:25 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r2600 r2602 1 /* $Id: blit.cpp,v 1. 2 2000-02-02 23:45:06 sandervlExp $ */1 /* $Id: blit.cpp,v 1.3 2000-02-03 10:23:24 dengert Exp $ */ 2 2 3 3 /* … … 38 38 if(dsect) 39 39 { 40 41 40 dprintf((" Do stretched DIB Blt\n")); 41 rc = dsect->BitBlt( hdcDest, 42 42 nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, 43 43 nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, 44 44 dwRop); 45 45 return rc; 46 46 } 47 47 } … … 58 58 if(dsect) { 59 59 rc = dsect->BitBlt(hdcDest, arg2, arg3, arg4, arg5, arg7, arg8, arg4, arg5, arg9); 60 61 62 63 64 65 66 67 68 69 70 71 72 73 60 if(rc) { 61 BITMAPINFO bmpinfo = {0}; 62 DIBSection *dest = DIBSection::findHDC(hdcDest); 63 if(dest) { 64 dprintf(("Sync dest DIB section")); 65 bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 66 GetDIBits(hdcDest, dest->GetBitmapHandle(), 0, 300, 0, &bmpinfo, dest->GetRGBUsage()); 67 dprintf(("height %d", bmpinfo.bmiHeader.biHeight)); 68 dprintf(("width %d", bmpinfo.bmiHeader.biWidth)); 69 dprintf(("biBitCount %d", bmpinfo.bmiHeader.biBitCount)); 70 GetDIBits(hdcDest, dest->GetBitmapHandle(), 0, 300, dest->GetDIBObject(), &bmpinfo, dest->GetRGBUsage()); 71 } 72 } 73 return rc; 74 74 } 75 75 } … … 79 79 //****************************************************************************** 80 80 //****************************************************************************** 81 INT WIN32API SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, 82 DWORD cy, INT xSrc, INT ySrc, 83 UINT startscan, UINT lines, LPCVOID bits, 81 INT WIN32API SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, 82 DWORD cy, INT xSrc, INT ySrc, 83 UINT startscan, UINT lines, LPCVOID bits, 84 84 const BITMAPINFO *info, UINT coloruse) 85 85 { … … 91 91 SetLastError(0); 92 92 if(info == NULL) { 93 93 goto invalid_parameter; 94 94 } 95 95 height = info->bmiHeader.biHeight; … … 98 98 if (height < 0) height = -height; 99 99 if (!lines || (startscan >= height)) { 100 100 goto invalid_parameter; 101 101 } 102 102 if (startscan + lines > height) lines = height - startscan; … … 130 130 //SvL: Ignore BI_BITFIELDS type (SetDIBitsToDevice fails otherwise) 131 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))); 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 } 132 DWORD *bitfields = (DWORD *)info->bmiColors; 133 134 dprintf(("BI_BITFIELDS compression %x %x %x", *bitfields, *(bitfields+1), *(bitfields+2))); 135 ((BITMAPINFO *)info)->bmiHeader.biCompression = 0; 136 compression = BI_BITFIELDS; 137 if(*(bitfields+1) == 0x3E0) {//RGB 555? 138 extern void _Optlink RGB555to565 (WORD *dest, WORD *src, ULONG num); 139 140 newbits = (WORD *)malloc(imgsize); 141 RGB555to565 (newbits, (WORD *)bits, imgsize/sizeof(WORD)); 142 bits = newbits; 143 } 153 144 } 154 145 155 146 if(info->bmiHeader.biHeight < 0) 156 147 ((BITMAPINFO *)info)->bmiHeader.biHeight = -info->bmiHeader.biHeight; 157 148 158 149 result = O32_SetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (PBITMAPINFO)info, coloruse); … … 165 156 166 157 if(compression == BI_BITFIELDS) { 167 168 158 ((BITMAPINFO *)info)->bmiHeader.biCompression = BI_BITFIELDS; 159 if(newbits) free(newbits); 169 160 } 170 161 return result;
Note:
See TracChangeset
for help on using the changeset viewer.