Changeset 587 for trunk/src/ddraw/OS2PALETTE.CPP
- Timestamp:
- Aug 19, 1999, 8:08:48 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2PALETTE.CPP
r522 r587 4 4 #include <memory.h> 5 5 #define INITGUID 6 #include "os2ddraw.h" 7 #include "os2clipper.h" 6 8 #include "os2palette.h" 9 #include "os2surface.h" 7 10 #define _OS2WIN_H 8 11 #define FAR … … 11 14 #include <winerror.h> 12 15 13 //****************************************************************************** 14 //****************************************************************************** 15 OS2IDirectDrawPalette::OS2IDirectDrawPalette( OS2IDirectDraw *lpDirectDraw, 16 #undef THIS 17 #define THIS IDirectDrawPalette* 18 19 //****************************************************************************** 20 //****************************************************************************** 21 OS2IDirectDrawPalette::OS2IDirectDrawPalette( VOID *lpDirectDraw, 16 22 int palsize, 17 23 LPPALETTEENTRY lpColorTable, … … 19 25 Referenced(0), os2pal(NULL), 20 26 lastError(DD_OK), lpDraw(NULL) 27 21 28 { 22 29 lpVtbl = &Vtbl; … … 30 37 31 38 lpDraw = lpDirectDraw; 32 lpDraw->Vtbl.AddRef(lpDraw);33 hDive = lpDirectDraw->GetDiveInstance();39 ((OS2IDirectDraw*)lpDraw)->Vtbl.AddRef(lpDraw); 40 hDive = ((OS2IDirectDraw*)lpDirectDraw)->GetDiveInstance(); 34 41 dwCaps = dwPalFlags; 42 hDiveCC = ((OS2IDirectDraw*)lpDirectDraw)->GetCCDiveInstance(); 35 43 36 44 dwSize = palsize; … … 41 49 os2pal = (LPPALETTEENTRY)malloc(palsize*sizeof(PALETTEENTRY)); 42 50 memcpy((char *)os2pal, (char *)lpColorTable, palsize*sizeof(PALETTEENTRY)); 51 52 for(DWORD i=0;i<dwSize;i++) 53 { 54 aPal16[i] = (lpColorTable[i].peBlue>>3) + 55 ((lpColorTable[i].peGreen>>2) <<5) + 56 ((lpColorTable[i].peRed>>3) << 11); 57 aPal24[i] = (lpColorTable[i].peBlue <<8) + 58 (lpColorTable[i].peGreen<<16) + 59 (lpColorTable[i].peRed<<24); 60 } 43 61 } 44 62 //****************************************************************************** … … 48 66 if(os2pal) 49 67 free(os2pal); 50 lpDraw->Vtbl.Release(lpDraw);68 ((OS2IDirectDraw*)lpDraw)->Vtbl.Release((OS2IDirectDraw*)lpDraw); 51 69 } 52 70 //****************************************************************************** … … 175 193 dwNumEntries*sizeof(PALETTEENTRY)); 176 194 177 if(me->fAttachedToPrimary) 178 me->SetPhysPalette(); 179 195 for(DWORD i=0;i<dwNumEntries;i++) 196 { 197 me->aPal16[dwBase+i] = (lpNewEntries[i].peBlue>>3) + 198 ((lpNewEntries[i].peGreen>>2) <<5) + 199 ((lpNewEntries[i].peRed>>3) << 11); 200 me->aPal24[dwBase+i] = (lpNewEntries[i].peBlue <<8) + 201 (lpNewEntries[i].peGreen<<16) + 202 (lpNewEntries[i].peRed<<24); 203 } 204 205 if(8==((OS2IDirectDraw*)me->lpDraw)->dCaps.ulDepth) 206 { 207 if(me->fAttachedToPrimary) 208 me->SetPhysPalette(); 209 } 210 else 211 { 212 if(NULL!=((OS2IDirectDraw*)me->lpDraw)->pPrimSurf) 213 ((OS2IDirectDrawSurface*)((OS2IDirectDraw*)me->lpDraw)->pPrimSurf)->ColorConversion(NULL);; 214 } 215 /* 216 if(NULL!=me->hDiveCC) 217 { 218 DiveSetSourcePalette( me->hDiveCC, 219 dwBase, 220 dwNumEntries, 221 (PBYTE)lpNewEntries); 222 223 } 224 else 225 { 226 // Only usefull if system and game are in 8bit mode 227 // 16bit games don't use palettes and setting the Phys palette 228 // in >8Bit Modes has no effect. 229 230 if(me->fAttachedToPrimary) 231 me->SetPhysPalette(); 232 } 233 */ 180 234 return(DD_OK); 181 235 } … … 199 253 return; 200 254 fAttachedToPrimary = fNewVal; 255 256 /* 201 257 if(fAttachedToPrimary) 202 SetPhysPalette(); 203 204 } 205 //****************************************************************************** 206 //****************************************************************************** 207 258 { 259 if(NULL!=hDiveCC) 260 DiveSetSourcePalette( hDiveCC, 261 0, 262 255, 263 (PBYTE)os2pal); 264 else 265 SetPhysPalette(); 266 } 267 */ 268 } 269 //****************************************************************************** 270 //****************************************************************************** 271
Note:
See TracChangeset
for help on using the changeset viewer.