Changeset 850 for trunk/src/ddraw/OS2SURFACE.CPP
- Timestamp:
- Sep 6, 1999, 11:40:08 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2SURFACE.CPP
r587 r850 17 17 #include "asmutil.h" 18 18 #include <winerror.h> 19 19 #include <os2win.h> 20 20 #ifndef __WATCOMC__ 21 21 #include <builtin.h> … … 24 24 extern FOURCC SupportedFourCCs[]; 25 25 // ToDo: Move the following 2 defines in the right WINE headers. 26 BYTE DefaultPalette[] = { 0x00,0x00,0x00, // 0 27 0x80,0x00,0x00, // 1 28 0x00,0x80,0x00, // 2 29 0x80,0x80,0x00, // 3 30 0x00,0x00,0x80, // 4 31 0x80,0x00,0x80, // 5 32 0x00,0x80,0x80, // 6 33 0xC0,0xC0,0xC0, // 7 34 0xC0,0xDC,0xC0, // 8 35 0xA6,0xCA,0xF0, // 9 36 0x04,0x04,0x04, // 10 37 0x08,0x08,0x08, // 11 38 0x0C,0x0C,0x0C, // 12 39 0x11,0x11,0x11, // 13 40 0x16,0x16,0x16, // 14 41 0x1C,0x1C,0x1C, // 15 42 0x22,0x22,0x22, // 16 43 0x29,0x29,0x29, // 17 44 0x55,0x55,0x55, // 18 45 0x4D,0x4D,0x4D, 46 0x42,0x42,0x42, 47 0x39,0x39,0x39, 48 0x81,0x81,0x81, 49 0x81,0x00,0x00, 50 0x00,0x81,0x00, 51 0x81,0x81,0x00, 52 0x00,0x00,0x81, 53 0x81,0x00,0x81, 54 0x00,0x81,0x81, 55 0x33,0x00,0x00, 56 0x66,0x00,0x00, 57 0x99,0x00,0x00, 58 0xCC,0x00,0x00, 59 0x00,0x33,0x00, 60 0x33,0x33,0x00, 61 0x66,0x33,0x00, 62 0x99,0x33,0x00, 63 0xCC,0x33,0x00, 64 0xFF,0x33,0x00, 65 0x00,0x66,0x00, 66 0x33,0x66,0x00, 67 0x66,0x66,0x00, 68 0x99,0x66,0x00, 69 0xCC,0x66,0x00, 70 0xFF,0x66,0x00, 71 0x00,0x99,0x00, 72 0x33,0x99,0x00, 73 0x66,0x99,0x00, 74 0x99,0x99,0x00, 75 0xCC,0x99,0x00, 76 0xFF,0x99,0x00, 77 0x00,0xCC,0x00, 78 0x33,0xCC,0x00, 79 0x66,0xCC,0x00, 80 0x99,0xCC,0x00, 81 0xCC,0xCC,0x00, 82 0xFF,0xCC,0x00, 83 0x66,0xFF,0x00, 84 0x99,0xFF,0x00, 85 0xCC,0xFF,0x00, 86 0x00,0x00,0x33, 87 0x33,0x00,0x33, 88 0x66,0x00,0x33, 89 0x99,0x00,0x33, 90 0xCC,0x00,0x33, 91 0xFF,0x00,0x33, 92 0x00,0x33,0x33, 93 0x33,0x33,0x33, 94 0x66,0x33,0x33, 95 0x99,0x33,0x33, 96 0xCC,0x33,0x33, 97 0xFF,0x33,0x33, 98 0x00,0x66,0x33, 99 0x33,0x66,0x33, 100 0x66,0x66,0x33, 101 0x99,0x66,0x33, 102 0xCC,0x66,0x33, 103 0xFF,0x66,0x33, 104 0x00,0x99,0x33, 105 0x33,0x99,0x33, 106 0x66,0x99,0x33, 107 0x99,0x99,0x33, 108 0xCC,0x99,0x33, 109 0xFF,0x99,0x33, 110 0x00,0xCC,0x33, 111 0x33,0xCC,0x33, 112 0x66,0xCC,0x33, 113 0x99,0xCC,0x33, 114 0xCC,0xCC,0x33, 115 0xFF,0xCC,0x33, 116 0x33,0xFF,0x33, 117 0x66,0xFF,0x33, 118 0x99,0xFF,0x33, 119 0xCC,0xFF,0x33, 120 0xFF,0xFF,0x33, 121 0x00,0x00,0x66, 122 0x33,0x00,0x66, 123 0x66,0x00,0x66, 124 0x99,0x00,0x66, 125 0xCC,0x00,0x66, 126 0xFF,0x00,0x66, 127 0x00,0x33,0x66, 128 0x33,0x33,0x66, 129 0x66,0x33,0x66, 130 0x99,0x33,0x66, 131 0xCC,0x33,0x66, 132 0xFF,0x33,0x66, 133 0x00,0x66,0x66, 134 0x33,0x66,0x66, 135 0x66,0x66,0x66, 136 0x99,0x66,0x66, 137 0xCC,0x66,0x66, 138 0x00,0x99,0x66, 139 0x33,0x99,0x66, 140 0x66,0x99,0x66, 141 0x99,0x99,0x66, 142 0xCC,0x99,0x66, 143 0xFF,0x99,0x66, 144 0x00,0xCC,0x66, 145 0x33,0xCC,0x66, 146 0x99,0xCC,0x66, 147 0xCC,0xCC,0x66, 148 0xFF,0xCC,0x66, 149 0x00,0xFF,0x66, 150 0x33,0xFF,0x66, 151 0x99,0xFF,0x66, 152 0xCC,0xFF,0x66, 153 0xFF,0x00,0xCC, 154 0xCC,0x00,0xFF, 155 0x00,0x99,0x99, 156 0x99,0x33,0x99, 157 0x99,0x00,0x99, 158 0xCC,0x00,0x99, 159 0x00,0x00,0x99, 160 0x33,0x33,0x99, 161 0x66,0x00,0x99, 162 0xCC,0x33,0x99, 163 0xFF,0x00,0x99, 164 0x00,0x66,0x99, 165 0x33,0x33,0x99, 166 0x33,0x66,0x99, 167 0x66,0x33,0x99, 168 0x99,0x33,0x99, 169 0xCC,0x66,0x99, 170 0xFF,0x33,0x99, 171 0x33,0x99,0x99, 172 0x66,0x99,0x99, 173 0x99,0x99,0x99, 174 0xCC,0x99,0x99, 175 0xFF,0x99,0x99, 176 0x00,0xCC,0x99, 177 0x33,0xCC,0x99, 178 0x66,0xCC,0x66, 179 0x99,0xCC,0x99, 180 0xCC,0xCC,0x99, 181 0xFF,0xCC,0x99, 182 0x00,0xFF,0x99, 183 0x33,0xFF,0x99, 184 0x66,0xCC,0x99, 185 0x99,0xFF,0x99, 186 0xCC,0xFF,0x99, 187 0xFF,0xFF,0x99, 188 0x00,0x00,0xCC, 189 0x33,0x00,0x99, 190 0x66,0x00,0xCC, 191 0x99,0x00,0xCC, 192 0xCC,0x00,0xCC, 193 0x00,0x33,0x99, 194 0x33,0x33,0xCC, 195 0x66,0x33,0xCC, 196 0x99,0x33,0xCC, 197 0xCC,0x33,0xCC, 198 0xFF,0x33,0xCC, 199 0x00,0x66,0xCC, 200 0x33,0x66,0xCC, 201 0x66,0x66,0x99, 202 0x99,0x66,0xCC, 203 0xCC,0x66,0xCC, 204 0xFF,0x66,0x99, 205 0x00,0x99,0xCC, 206 0x33,0x99,0xCC, 207 0x66,0x99,0xCC, 208 0x99,0x99,0xCC, 209 0xCC,0x99,0xCC, 210 0xFF,0x99,0xCC, 211 0x00,0xCC,0xCC, 212 0x33,0xCC,0xCC, 213 0x66,0xCC,0xCC, 214 0x99,0xCC,0xCC, 215 0xCC,0xCC,0xCC, 216 0xFF,0xCC,0xCC, 217 0x00,0xFF,0xCC, 218 0x33,0xFF,0xCC, 219 0x66,0xFF,0x99, 220 0x99,0xFF,0xCC, 221 0xCC,0xFF,0xCC, 222 0xFF,0xFF,0xCC, 223 0x33,0x00,0xCC, 224 0x66,0x00,0xFF, 225 0x99,0x00,0xFF, 226 0x00,0x33,0xCC, 227 0x33,0x33,0xFF, 228 0x66,0x33,0xFF, 229 0x99,0x33,0xFF, 230 0xCC,0x33,0xFF, 231 0xFF,0x33,0xFF, 232 0x00,0x66,0xFF, 233 0x33,0x66,0xFF, 234 0x66,0x66,0xCC, 235 0x99,0x66,0xFF, 236 0xCC,0x66,0xFF, 237 0xFF,0x66,0xCC, 238 0x00,0x99,0xFF, 239 0x33,0x99,0xFF, 240 0x66,0x99,0xFF, 241 0x99,0x99,0xFF, 242 0xCC,0x99,0xFF, 243 0xFF,0x99,0xFF, 244 0x00,0xCC,0xFF, 245 0x33,0xCC,0xFF, 246 0x66,0xCC,0xFF, 247 0x99,0xCC,0xFF, 248 0xCC,0xCC,0xFF, 249 0xFF,0xCC,0xFF, 250 0x33,0xFF,0xFF, 251 0x66,0xFF,0xCC, 252 0x99,0xFF,0xFF, 253 0xCC,0xFF,0xFF, 254 0xFF,0x66,0x66, 255 0x66,0xFF,0x66, 256 0xFF,0xFF,0x66, 257 0x66,0x66,0xFF, 258 0xFF,0x66,0xFF, 259 0x66,0xFF,0xFF, 260 0xC1,0xC1,0xC1, 261 0x5F,0x5F,0x5F, 262 0x77,0x77,0x77, 263 0x86,0x86,0x86, 264 0x96,0x96,0x96, 265 0xCB,0xCB,0xCB, 266 0xB2,0xB2,0xB2, 267 0xD7,0xD7,0xD7, 268 0xDD,0xDD,0xDD, 269 0xE3,0xE3,0xE3, 270 0xEA,0xEA,0xEA, 271 0xF1,0xF1,0xF1, 272 0xF8,0xF8,0xF8, 273 0xFF,0xFB,0xF0, 274 0xA0,0xA0,0xA4, 275 0x80,0x80,0x80, 276 0xFF,0x00,0x00, 277 0x00,0xFF,0x00, 278 0xFF,0xFF,0x00, 279 0x00,0x00,0xFF, 280 0xFF,0x00,0xFF, 281 // 0x00,0xFF,0xFF, 282 0xFF,0xFF,0xFF}; 283 284 WORD wDefaultPalete16[256]; 285 BOOL fPalInit=FALSE; 26 286 27 287 #define CBM_CREATEDIB 0x02L /* create DIB bitmap */ … … 113 373 if (flags[i].mask & flagmask) 114 374 WriteLog("%s ",flags[i].name); 375 WriteLog("\n"); 115 376 } 116 377 … … 411 672 // Check if OS/2 is running in the requested colormode 412 673 674 diveBufNr = DIVE_BUFFER_SCREEN; 413 675 if( lpDraw->dCaps.ulDepth == lpDraw->GetScreenBpp() ) 414 676 { … … 417 679 // Yes so direct access to framebuffer is possible 418 680 419 diveBufNr = DIVE_BUFFER_SCREEN;420 681 pFrameBuffer = lpDraw->GetFrameBuffer(); 421 682 pDiveBuffer = pFrameBuffer; … … 557 818 558 819 BackBuffer = new OS2IDirectDrawSurface(lpDraw, &ComplexSurfaceDesc, TRUE, TRUE); 820 559 821 if (BackBuffer->GetLastError()==DD_OK) 560 822 { 823 WriteLog("created backbuffer"); 561 824 // Our Primary Buffer is also the frontbuffer of a flipchain 562 DDSurfaceDesc.dwFlags |= DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP; 825 DDSurfaceDesc.ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP; 826 lpDDSurfaceDesc->ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP; 563 827 BackBuffer->SetFrontBuffer(this); 828 } 829 else 830 { 831 WriteLog("Error creating backbuffer"); 564 832 } 565 833 } … … 810 1078 { 811 1079 WriteLog("with DIVE\n"); 812 // This surface is part of flipchain with the primary surface use dive to alloc 1080 // This surface is part of flipchain with the primary surface use dive to assoc memory 1081 pDiveBuffer = (char*)malloc( lpDDSurfaceDesc->dwHeight * 1082 dwPitchDB); 813 1083 diveBufNr = 0; 814 DiveAllocImageBuffer( hDive, 815 &diveBufNr, 816 lpDraw->dCaps.fccColorEncoding, 817 lpDDSurfaceDesc->dwWidth, 818 lpDDSurfaceDesc->dwHeight, 819 dwPitchDB, 820 (PBYTE)pDiveBuffer); 1084 rc = DiveAllocImageBuffer( hDive, 1085 &diveBufNr, 1086 lpDraw->dCaps.fccColorEncoding, 1087 lpDDSurfaceDesc->dwWidth, 1088 lpDDSurfaceDesc->dwHeight, 1089 dwPitchDB, 1090 (PBYTE)pDiveBuffer); 1091 WriteLog("rc = 0x%08X\n",rc); 821 1092 } 822 1093 else … … 952 1223 953 1224 DWORD *pColor, dwColor,y; 954 955 #ifdef DEBUG 956 WriteLog("ColorFill\n"); 1225 DWORD *pPal24; 1226 WORD *pPal16; 1227 #ifdef DEBUG 1228 WriteLog("ColorFill with %08X\n", dwFillColor); 957 1229 #endif 958 1230 … … 971 1243 else 972 1244 { 1245 WriteLog("Fill all at addr "); 973 1246 FillWidth = width; 974 1247 FillHeight = height -1; 975 1248 pLine = pDiveBuffer; 976 1249 } 977 1250 WriteLog("0x%08X (%d/%d) at\n", pLine,FillWidth,FillHeight); 1251 1252 if(pDiveBuffer!=pFrameBuffer) 1253 { 1254 if( (NULL== lpDraw->pPrimSurf) || 1255 (NULL== ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette) ) 1256 { 1257 if(!fPalInit) 1258 { 1259 for(DWORD i=0;i<256;i++) 1260 { 1261 wDefaultPalete16[i] = (DefaultPalette[i*3+2]>>3) + 1262 ((DefaultPalette[i*3+1]>>2) <<5) + 1263 ((DefaultPalette[i*3]>>3) << 11); 1264 WriteLog( " # %d : RGB=%02X/%02X/%02X => %04X\n", 1265 i, 1266 DefaultPalette[i*3], 1267 DefaultPalette[i*3+1], 1268 DefaultPalette[i*3+2], 1269 wDefaultPalete16[i]); 1270 // aPal24[i] = (lpColorTable[i].peBlue <<8) + 1271 // (lpColorTable[i].peGreen<<16) + 1272 // (lpColorTable[i].peRed<<24); 1273 } 1274 fPalInit = TRUE; 1275 } 1276 pPal16 = &wDefaultPalete16[0]; 1277 } 1278 else 1279 { 1280 pPal16 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal16; 1281 pPal24 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal24; 1282 } 1283 } 978 1284 979 1285 switch(dwBytesPPDive) 980 1286 { 981 1287 case 1: 1288 WriteLog("8 Bit\n"); 982 1289 dwColor = (dwFillColor<<24) + (dwFillColor<<16) + 983 1290 (dwFillColor<<8) + (dwFillColor); … … 988 1295 pFillPos = (char*) (&pColor[i-1]); 989 1296 for(i=0;i<FillWidth % 4;i++) 990 pFillPos[i] = (UCHAR) dwColor;1297 pFillPos[i] = (UCHAR) dwColor; 991 1298 } 992 1299 break; 993 1300 case 2: 1301 WriteLog("16 Bit\n"); 1302 if(pDiveBuffer!=pFrameBuffer) 1303 { 1304 if(8==lpDraw->GetScreenBpp()) 1305 dwFillColor = pPal16[dwFillColor]; 1306 } 994 1307 dwColor = (dwFillColor<<16) + (dwFillColor); 1308 WriteLog("Fill with 0x%08X\n",dwColor); 995 1309 for(i=0,pColor = (DWORD*)pLine;i<(FillWidth/2);i++) 996 1310 pColor[i] = dwColor; … … 1002 1316 break; 1003 1317 case 3: 1318 WriteLog("24 Bit\n"); 1319 1004 1320 dwColor = (dwFillColor<<8); 1005 1321 for(i=0 ; i<FillWidth ; i++) … … 1010 1326 break; 1011 1327 case 4: 1328 WriteLog("32 Bit\n"); 1012 1329 dwColor = dwFillColor; 1013 1330 for(i=0,pColor = (DWORD*)pLine;i<FillWidth;i++) … … 1023 1340 1024 1341 pFillPos = pLine + dwPitchDB; 1025 1342 FillWidth = FillWidth*dwBytesPPDive;; 1026 1343 for( y=0;y<FillHeight;y++,pFillPos+=dwPitchDB) 1027 1344 { … … 1190 1507 WORD *pPal16; 1191 1508 1192 if(NULL== lpDraw->pPrimSurf) 1193 { 1194 WriteLog("No Primary Surface! => No CC\n"); 1195 return; 1196 } 1197 1198 if(NULL== ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette) 1199 { 1200 WriteLog("No DDrawpalette defined!=> No CC\n"); 1201 return; 1509 if( (NULL== lpDraw->pPrimSurf) || 1510 (NULL== ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette) ) 1511 { 1512 if(!fPalInit) 1513 { 1514 for(DWORD i=0;i<256;i++) 1515 { 1516 wDefaultPalete16[i] = (DefaultPalette[i*3+2]>>3) + 1517 ((DefaultPalette[i*3+1]>>2) <<5) + 1518 ((DefaultPalette[i*3]>>3) << 11); 1519 WriteLog( " # %d : RGB=%02X/%02X/%02X => %04X\n", 1520 i, 1521 DefaultPalette[i*3], 1522 DefaultPalette[i*3+1], 1523 DefaultPalette[i*3+2], 1524 wDefaultPalete16[i]); 1525 // aPal24[i] = (lpColorTable[i].peBlue <<8) + 1526 // (lpColorTable[i].peGreen<<16) + 1527 // (lpColorTable[i].peRed<<24); 1528 } 1529 fPalInit = TRUE; 1530 } 1531 pPal16 = &wDefaultPalete16[0]; 1532 } 1533 else 1534 { 1535 pPal16 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal16; 1536 pPal24 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal24; 1202 1537 } 1203 1538 … … 1244 1579 if(8==lpDraw->GetScreenBpp()) 1245 1580 { 1246 pPal16 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal16;1247 1581 WriteLog("8->16Bit CC\n"); 1248 1582 for(y=0;CCheight;CCheight--,y++) 1249 1583 { 1250 WriteLog("Converting Line %d\n",y);1251 1584 for(x=0;x<width;x++) 1252 1585 { … … 1269 1602 else 1270 1603 { 1271 WriteLog("%d -> 16Bit Not implemented",lpDraw->GetScreenBpp());1604 WriteLog("%d ->24Bit Not implemented",lpDraw->GetScreenBpp()); 1272 1605 } 1273 1606 break; … … 1279 1612 else 1280 1613 { 1281 WriteLog("%d -> 16Bit Not implemented",lpDraw->GetScreenBpp());1614 WriteLog("%d ->32Bit Not implemented",lpDraw->GetScreenBpp()); 1282 1615 } 1283 1616 break; … … 1470 1803 if (NULL==NewFBuffer) 1471 1804 { 1805 1806 WriteLog("Remove Frontbuffer\n"); 1807 1472 1808 // The real Frontbuffer was removed check if I'm now the one 1473 1809 if(NULL!=BackBuffer) 1474 1810 { 1811 WriteLog("We have the a backbuffer so we're the Frontbuffer\n"); 1812 NextFlip = BackBuffer; 1475 1813 DDSurfaceDesc.ddsCaps.dwCaps &= ~DDSCAPS_BACKBUFFER; 1476 1814 DDSurfaceDesc.ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER; … … 1480 1818 { 1481 1819 // Flipchain is destroyed 1820 WriteLog("No longer part of a flipchain\n"); 1482 1821 DDSurfaceDesc.ddsCaps.dwCaps &= ~(DDSCAPS_BACKBUFFER | DDSCAPS_FLIP); 1483 1822 } … … 1485 1824 else 1486 1825 { 1826 WriteLog("Set new Frontbuffer to 0x%08X\n",NewFBuffer); 1487 1827 if(NULL==NewFBuffer->GetFrontBuffer()) 1488 1828 { 1829 WriteLog("We're the 1st backbuffer\n"); 1489 1830 DDSurfaceDesc.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER | DDSCAPS_FLIP; 1831 FrontBuffer->NextFlip = this; 1490 1832 } 1491 1833 else 1492 1834 { 1835 WriteLog("We are oe of many buffers\n"); 1493 1836 DDSurfaceDesc.ddsCaps.dwCaps &= ~DDSCAPS_BACKBUFFER ; 1494 1837 DDSurfaceDesc.ddsCaps.dwCaps |= DDSCAPS_FLIP; … … 1770 2113 } 1771 2114 } 1772 2115 WriteLog("Surface attached\n"); 1773 2116 return(DD_OK); 1774 2117 } … … 3273 3616 LPVOID Data; 3274 3617 char *pcrFB,*pcFB,*pcrDB,*pcDB; 3618 ULONG rc; 3275 3619 3276 3620 #ifdef DEBUG … … 3284 3628 WriteLog("Flip called on none Frontbuffer/Flip surface\n Flags:\n"); 3285 3629 _dump_DDSCAPS(me->DDSurfaceDesc.ddsCaps.dwCaps); 3630 WriteLog("\n"); 3286 3631 #endif 3287 3632 return(DDERR_NOTFLIPPABLE); … … 3290 3635 if(NULL!=lpDDSurf) 3291 3636 { 3637 #ifdef DEBUG 3638 WriteLog("Check if Surface is in Flipchain!\n"); 3639 #endif 3640 3292 3641 // We got an override surface check if it is in the flipchain 3293 3642 FlipSurface = (OS2IDirectDrawSurface*) lpDDSurf; … … 3307 3656 } 3308 3657 else 3658 { 3309 3659 FlipSurface = me->NextFlip; // Take the next Surface in the Flipchain 3310 3660 #ifdef DEBUG 3661 WriteLog("Next Surface @ 0x%08X\n",FlipSurface); 3662 #endif 3663 } 3311 3664 3312 3665 if((me->fLocked)||(FlipSurface->fLocked)) … … 3320 3673 if(-1 != me->diveBufNr) 3321 3674 { 3675 #ifdef DEBUG 3676 WriteLog("DIVE Flipchain"); 3677 #endif 3678 3322 3679 // we got some DIVE surfaces 3323 3680 // On Dive Buffers More then Double buffering won't get any perf. gain … … 3325 3682 // Doulebuffering should work best. 3326 3683 3327 DiveBlitImage(me->hDive, FlipSurface->diveBufNr, me->diveBufNr); 3684 rc = DiveBlitImage(me->hDive, FlipSurface->diveBufNr, me->diveBufNr); 3685 3686 #ifdef DEBUG 3687 WriteLog("DiveBlitImage rc = 0x%08X\n"); 3688 #endif 3328 3689 3329 3690 if(NULL==lpDDSurf) … … 3335 3696 else 3336 3697 { 3698 #ifdef DEBUG 3699 WriteLog("Memory Flipchain"); 3700 #endif 3337 3701 // Memory Flipchain 3338 3702 // … … 3346 3710 // Memory: 11 22 33 22 33 11 3347 3711 // 3712 3348 3713 Data = me->DDSurfaceDesc.lpSurface; 3349 3714 pcrFB = me->pFBreal; … … 3583 3948 DDSURFACEDESC2 LockedSurfaceDesc; 3584 3949 HRESULT rc; 3950 BITMAP bmpSurface; 3585 3951 struct 3586 3952 { … … 3622 3988 (me->hbmImage == NULL) ) 3623 3989 { 3990 WriteLog( "Trying to create Bitmap (%d/%d) at %d Bit\n", 3991 LockedSurfaceDesc.lPitch/ (LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount>>3), 3992 LockedSurfaceDesc.dwHeight, 3993 LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount 3994 ); 3995 #if 0 3624 3996 memset(&BitmapInfo, 0, sizeof(BitmapInfo)); 3625 3997 BitmapInfo.bmiHead.biSize = sizeof(BITMAPINFOHEADER); … … 3628 4000 BitmapInfo.bmiHead.biPlanes = 1; 3629 4001 BitmapInfo.bmiHead.biBitCount = LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; 4002 #else 4003 bmpSurface.bmType = 0; 4004 bmpSurface.bmWidth = LockedSurfaceDesc.dwWidth; 4005 bmpSurface.bmHeight = LockedSurfaceDesc.dwHeight; 4006 bmpSurface.bmWidthBytes = LockedSurfaceDesc.lPitch; 4007 bmpSurface.bmPlanes = 1; 4008 bmpSurface.bmBits = LockedSurfaceDesc.lpSurface; 4009 #endif 3630 4010 switch(LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount) 3631 4011 { 3632 4012 case 1: 3633 4013 case 4: 4014 WriteLog("1/4 Bit Not yet supported\n"); 4015 break; 3634 4016 case 8: 4017 #if 0 3635 4018 BitmapInfo.bmiHead.biCompression = BI_RGB; 3636 4019 GetSystemPaletteEntries(me->hdcImage,0,255,(PPALETTEENTRY)&BitmapInfo.bmiCols[0]); … … 3641 4024 (PBITMAPINFO)&BitmapInfo, 3642 4025 DIB_RGB_COLORS); 4026 #else 4027 bmpSurface.bmBitsPixel = 8; 4028 me->hbmImage = CreateBitmapIndirect( &bmpSurface); 4029 #endif 3643 4030 break; 3644 4031 case 16: 3645 4032 case 32: 3646 BitmapInfo.bmiHead.biCompression = BI_BITFIELDS; 3647 BitmapInfo.bmiHead.biClrUsed = 3; 3648 *((DWORD *) &(BitmapInfo.bmiCols[0])) = LockedSurfaceDesc.ddpfPixelFormat.dwRBitMask; 3649 *((DWORD *) &(BitmapInfo.bmiCols[1])) = LockedSurfaceDesc.ddpfPixelFormat.dwGBitMask; 3650 *((DWORD *) &(BitmapInfo.bmiCols[2])) = LockedSurfaceDesc.ddpfPixelFormat.dwBBitMask; 3651 me->hbmImage = CreateDIBitmap(me->hdcImage,NULL,CBM_CREATEDIB,LockedSurfaceDesc.lpSurface, 3652 (PBITMAPINFO)&BitmapInfo,DIB_RGB_COLORS); 4033 WriteLog("16/32 Bit not supported by OS/2"); 3653 4034 break; 3654 4035 case 24: 4036 #if 0 3655 4037 BitmapInfo.bmiHead.biCompression = BI_RGB; 3656 me->hbmImage = CreateDIBitmap(me->hdcImage,NULL,CBM_CREATEDIB,LockedSurfaceDesc.lpSurface, 3657 (PBITMAPINFO)&BitmapInfo,DIB_RGB_COLORS); 4038 me->hbmImage = CreateDIBitmap( me->hdcImage, 4039 NULL, 4040 CBM_CREATEDIB, 4041 LockedSurfaceDesc.lpSurface, 4042 (PBITMAPINFO)&BitmapInfo, 4043 DIB_RGB_COLORS); 4044 #else 4045 bmpSurface.bmBitsPixel = 24; 4046 me->hbmImage = CreateBitmapIndirect( &bmpSurface); 4047 #endif 3658 4048 break; 3659 4049 default: 3660 4050 #ifdef DEBUG 3661 WriteLog("Unexptected BitCount %d \n",LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount); 4051 WriteLog( "Unexptected BitCount %d \n", 4052 LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount); 3662 4053 #endif 3663 4054 me->hbmImage=NULL; … … 4066 4457 RGBQUAD bmiCols[256]; 4067 4458 } BitmapInfo; 4068 int i; 4459 BITMAP bmpData; 4460 char szError[256]; 4461 int i,rc; 4069 4462 4070 4463 #ifdef DEBUG … … 4075 4468 return(DDERR_INVALIDOBJECT); 4076 4469 4470 #if 1 4077 4471 //unselect our bitmap 4078 4472 SelectObject(me->hdcImage, me->hgdiOld); 4079 4080 4473 memset(&BitmapInfo,0, sizeof(BitmapInfo)); 4081 4474 BitmapInfo.bmiHead.biSize = sizeof(BITMAPINFOHEADER); … … 4083 4476 BitmapInfo.bmiHead.biHeight = me->DDSurfaceDesc.dwHeight; 4084 4477 BitmapInfo.bmiHead.biPlanes = 1; 4085 BitmapInfo.bmiHead.biBitCount = me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;4478 BitmapInfo.bmiHead.biBitCount = 0; // me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; 4086 4479 4087 4480 switch(me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount) … … 4091 4484 case 8: 4092 4485 BitmapInfo.bmiHead.biCompression = BI_RGB; 4093 GetSystemPaletteEntries(me->hdcImage,0,255,(PPALETTEENTRY)&BitmapInfo.bmiCols[0]); 4094 GetDIBits(hdc, me->hbmImage, 0, me->DDSurfaceDesc.dwHeight, 4486 //GetSystemPaletteEntries(me->hdcImage,0,255,(PPALETTEENTRY)&BitmapInfo.bmiCols[0]); 4487 rc = GetDIBits(hdc, me->hbmImage, 0, me->DDSurfaceDesc.dwHeight, 4488 NULL,(PBITMAPINFO)&BitmapInfo,DIB_PAL_COLORS); 4489 WriteLog( "GetDIBits rc=%d\n Size :%d\n Width :%d\n Height :%d\n" 4490 " Planes :%d\n BitCount :%d\nLastEror = %d\n", 4491 rc, 4492 BitmapInfo.bmiHead.biSize, 4493 BitmapInfo.bmiHead.biWidth, 4494 BitmapInfo.bmiHead.biHeight, 4495 BitmapInfo.bmiHead.biPlanes, 4496 BitmapInfo.bmiHead.biBitCount, 4497 GetLastError()); 4498 /* 4499 rc = GetDIBits(hdc, me->hbmImage, 0, me->DDSurfaceDesc.dwHeight, 4095 4500 me->DDSurfaceDesc.lpSurface,(PBITMAPINFO)&BitmapInfo,DIB_PAL_COLORS); 4501 WriteLog( "GetDIBits rc=%d\n LastEror = %d\n", 4502 rc, 4503 GetLastError()); 4504 */ 4096 4505 break; 4097 4506 case 16: … … 4117 4526 break; 4118 4527 } // end switch (me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount) 4119 4528 #else 4529 4530 rc = GetObjectA( me->hbmImage, 4531 sizeof(BITMAP), 4532 &bmpData); 4533 WriteLog( "GetObject returned rc=%d\n BitmapInfo:\n Size:(%dx%d)\n Pitch: %d\n Bits %d\n @mem %08X", 4534 rc, 4535 bmpData.bmWidth, bmpData.bmHeight, 4536 bmpData.bmWidthBytes, 4537 bmpData.bmBitsPixel, 4538 bmpData.bmBits); 4539 #endif 4120 4540 me->Vtbl.Unlock(me,NULL); 4121 4541 me->dwLastDCUnique = me->dwUniqueValue; // Store this to see if the surface was locked after we released the DC
Note:
See TracChangeset
for help on using the changeset viewer.