Changeset 5689 for trunk/src/gdi32/blit.cpp
- Timestamp:
- May 11, 2001, 4:59:26 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r5677 r5689 1 /* $Id: blit.cpp,v 1.2 5 2001-05-10 17:03:17sandervl Exp $ */1 /* $Id: blit.cpp,v 1.26 2001-05-11 14:59:26 sandervl Exp $ */ 2 2 3 3 /* … … 99 99 char *ptr; 100 100 ULONG compression = 0, bmpsize; 101 WORD *newbits = 0; 101 WORD *newbits = NULL; 102 DWORD bitfields[3]; 102 103 103 104 dprintf(("GDI32: SetDIBitsToDevice hdc:%X xDest:%d yDest:%d, cx:%d, cy:%d, xSrc:%d, ySrc:%d, startscan:%d, lines:%d \nGDI32: bits 0x%X, info 0x%X, coloruse %d", … … 130 131 //SvL: RP7's bitmap size is not correct; fix it here or else 131 132 // the blit is messed up in Open32 133 imgsize = CalcBitmapSize(info->bmiHeader.biBitCount, 134 info->bmiHeader.biWidth, info->bmiHeader.biHeight); 132 135 bmpsize = info->bmiHeader.biSizeImage; 133 136 if(info->bmiHeader.biCompression == 0 && info->bmiHeader.biSizeImage && … … 137 140 } 138 141 142 switch(info->bmiHeader.biBitCount) { 143 case 15: 144 case 16: 145 bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors : 0x7c00; 146 bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 1) : 0x03e0; 147 bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 2) : 0x001f; 148 break; 149 case 32: 150 bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors : 0xff0000; 151 bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 1) : 0xff00; 152 bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 2) : 0xff; 153 break; 154 default: 155 bitfields[0] = 0; 156 bitfields[1] = 0; 157 bitfields[2] = 0; 158 break; 159 } 160 if(bitfields[1] == 0x3E0) 161 {//RGB 555? 162 dprintf(("BI_BITFIELDS compression %x %x %x", *bitfields, *(bitfields+1), *(bitfields+2))); 163 164 newbits = (WORD *)malloc(imgsize); 165 if(CPUFeatures & CPUID_MMX) { 166 RGB555to565MMX(newbits, (WORD *)bits, imgsize/sizeof(WORD)); 167 } 168 else RGB555to565(newbits, (WORD *)bits, imgsize/sizeof(WORD)); 169 bits = newbits; 170 } 171 139 172 //SvL: Ignore BI_BITFIELDS type (SetDIBitsToDevice fails otherwise) 140 173 if(info->bmiHeader.biCompression == BI_BITFIELDS) { 141 DWORD *bitfields = (DWORD *)info->bmiColors;142 143 174 ((BITMAPINFO *)info)->bmiHeader.biCompression = 0; 144 175 compression = BI_BITFIELDS; 145 176 146 if(*(bitfields+1) == 0x3E0) 147 {//RGB 555? 148 dprintf(("BI_BITFIELDS compression %x %x %x", *bitfields, *(bitfields+1), *(bitfields+2))); 149 150 newbits = (WORD *)malloc(imgsize); 151 if(CPUFeatures & CPUID_MMX) { 152 RGB555to565MMX(newbits, (WORD *)bits, imgsize/sizeof(WORD)); 153 } 154 else RGB555to565(newbits, (WORD *)bits, imgsize/sizeof(WORD)); 155 bits = newbits; 156 } 157 } 158 177 } 159 178 if(startscan != 0 || lines != info->bmiHeader.biHeight) { 160 179 dprintf(("WARNING: SetDIBitsToDevice startscan != 0 || lines != info->bmiHeader.biHeight")); … … 190 209 if(compression == BI_BITFIELDS) { 191 210 ((BITMAPINFO *)info)->bmiHeader.biCompression = BI_BITFIELDS; 192 if(newbits) free(newbits);193 }211 } 212 if(newbits) free(newbits); 194 213 ((BITMAPINFO *)info)->bmiHeader.biSizeImage = bmpsize; 195 214 return result;
Note:
See TracChangeset
for help on using the changeset viewer.