Changeset 8830 for trunk/src/ddraw/fillfunc.cpp
- Timestamp:
- Jul 3, 2002, 5:44:39 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/fillfunc.cpp
r8821 r8830 1 /* $Id: fillfunc.cpp,v 1. 7 2002-07-02 09:55:13sandervl Exp $ */1 /* $Id: fillfunc.cpp,v 1.8 2002-07-03 15:44:39 sandervl Exp $ */ 2 2 3 3 /* … … 16 16 #include <misc.h> 17 17 #include "fillfunc.h" 18 #include "asmutil.h" 18 19 19 20 // … … 21 22 // 22 23 23 #ifndef USE_ASM 24 void __cdecl Fill8( char* pDst, 25 DWORD dwWidth, 26 DWORD dwHeight, 27 DWORD dwPitch, 28 DWORD dwColor) 29 { 30 DWORD *pColor; 31 char *pFillPos; 32 int i; 33 dprintf(("DDRAW:Fill8 with %08X\n",dwColor)); 34 35 // First Fill First row with the color 36 37 for( i=0,pColor = (DWORD*)pDst;i<(dwWidth/4);i++) 38 pColor[i] = dwColor; 39 40 if(dwWidth % 4) 41 { 42 if(i==0) i = 1; //or else next line will corrupt heap 43 pFillPos = (char*) (&pColor[i-1]); 44 for(i=0;i<dwWidth % 4;i++) 45 pFillPos[i] = (UCHAR) dwColor; 24 //***************************************************************************** 25 //***************************************************************************** 26 void CDECL Fill8(char* pDst, DWORD dwWidth, DWORD dwHeight, DWORD dwPitch, DWORD dwColor) 27 { 28 DWORD *pColor; 29 char *pFillPos; 30 31 dprintf(("DDRAW:Fill8 %x (%d,%d) %d with %x \n", pDst, dwWidth, dwHeight, dwPitch, dwColor)); 32 33 if(dwWidth == dwPitch) 34 { 35 // Width = Pitch => fill buffer so no need to take care of lines 36 memset(pDst, dwColor, dwWidth*dwHeight); 37 } 38 else 39 { 40 pFillPos = pDst; 41 42 while(dwHeight) 43 { 44 memset(pFillPos, dwColor, dwWidth); 45 pFillPos += dwPitch; 46 dwHeight--; 47 } 48 } 49 } 50 //***************************************************************************** 51 //***************************************************************************** 52 void CDECL Fill16(char* pDst, DWORD dwWidth, DWORD dwHeight, DWORD dwPitch, DWORD dwColor) 53 { 54 DWORD *pColor; 55 char *pFillPos; 56 57 dprintf(("DDRAW:Fill16 %x (%d,%d) %d with %x \n", pDst, dwWidth, dwHeight, dwPitch, dwColor)); 58 59 dwWidth *=2; 60 61 if(dwWidth == dwPitch) 62 { 63 // Width = Pitch => fill buffer so no need to take care of lines 64 ddmemfill16(pDst, dwColor, dwWidth*dwHeight); 65 } 66 else 67 { 68 pFillPos = pDst; 69 70 while(dwHeight) 71 { 72 ddmemfill16(pFillPos, dwColor, dwWidth); 73 pFillPos += dwPitch; 74 dwHeight--; 75 } 76 } 77 } 78 //***************************************************************************** 79 //***************************************************************************** 80 void CDECL Fill24(char* pDst, DWORD dwWidth, DWORD dwHeight, DWORD dwPitch, DWORD dwColor) 81 { 82 DWORD *pColor; 83 char *pFillPos; 84 int i; 85 86 dprintf(("DDRAW:Fill24 %x (%d,%d) %d with %x \n", pDst, dwWidth, dwHeight, dwPitch, dwColor)); 87 88 // First Fill First row with the color 89 90 for(i=0 ; i<dwWidth ; i++) 91 { 92 pColor = (DWORD*)(pDst+(i*3)); 93 *pColor = dwColor; 94 } 95 dwWidth *=3; 96 dwHeight--; 97 98 if(dwWidth == dwPitch) 99 { 100 // Width = Pitch => fill buffer so no need to take care of lines 101 memcpy(pDst+dwPitch, pDst, dwWidth*dwHeight); 102 } 103 else 104 { 105 pFillPos = pDst+dwPitch; 106 while(dwHeight) 107 { 108 memcpy(pFillPos,pDst,dwWidth); 109 pFillPos += dwPitch; 110 dwHeight--; 111 } 112 } 113 } 114 //***************************************************************************** 115 //***************************************************************************** 116 void CDECL Fill32(char* pDst, DWORD dwWidth, DWORD dwHeight, DWORD dwPitch, DWORD dwColor) 117 { 118 DWORD *pColor; 119 char *pFillPos; 120 121 dprintf(("DDRAW:Fill32 %x (%d,%d) %d with %x \n", pDst, dwWidth, dwHeight, dwPitch, dwColor)); 122 123 dwWidth *= 4; 124 125 if(dwWidth == dwPitch) 126 { 127 // Width = Pitch => fill buffer so no need to take care of lines 128 ddmemfill32(pDst, dwColor, dwWidth*dwHeight); 129 } 130 else 131 { 132 pFillPos = pDst; 133 134 while(dwHeight) 135 { 136 ddmemfill32(pFillPos, dwColor, dwWidth); 137 pFillPos += dwPitch; 138 dwHeight--; 139 } 46 140 } 47 48 dwHeight--; 49 50 if(dwWidth == dwPitch) 51 { 52 // Width = Pitch => fill buffer so no need to take care of lines 53 memcpy(pDst+dwPitch, pDst, dwWidth*dwHeight); 54 } 55 else 56 { 57 pFillPos = pDst+dwPitch; 58 while(dwHeight) 59 { 60 memcpy(pFillPos,pDst,dwWidth); 61 pFillPos += dwPitch; 62 dwHeight--; 63 } 64 } 65 } 66 void __cdecl Fill16( char* pDst, 67 DWORD dwWidth, 68 DWORD dwHeight, 69 DWORD dwPitch, 70 DWORD dwColor) 71 { 72 DWORD *pColor; 73 char *pFillPos; 74 int i; 75 dprintf(("DDRAW:Fill16 with %08X \n",dwColor)); 76 77 // First Fill First row with the color 78 79 for( i=0,pColor = (DWORD*)pDst;i<(dwWidth/2);i++) 80 pColor[i] = dwColor; 81 82 if(dwWidth % 2) 83 { 84 if(i==0) i = 1; //or else next line will corrupt heap 85 pFillPos = (char*)(&pColor[i-1]); 86 *((USHORT*)pFillPos) = (USHORT)dwColor; 87 } 88 89 dwWidth *=2; 90 dwHeight--; 91 92 if(dwWidth == dwPitch) 93 { 94 // Width = Pitch => fill buffer so no need to take care of lines 95 memcpy(pDst+dwPitch, pDst, dwWidth*dwHeight); 96 } 97 else 98 { 99 pFillPos = pDst+dwPitch; 100 while(dwHeight) 101 { 102 memcpy(pFillPos,pDst,dwWidth); 103 pFillPos += dwPitch; 104 dwHeight--; 105 } 106 } 107 } 108 void __cdecl Fill24( char* pDst, 109 DWORD dwWidth, 110 DWORD dwHeight, 111 DWORD dwPitch, 112 DWORD dwColor) 113 { 114 DWORD *pColor; 115 char *pFillPos; 116 int i; 117 dprintf(("DDRAW:Fill24 with %08X \n",dwColor)); 118 119 // First Fill First row with the color 120 121 for(i=0 ; i<dwWidth ; i++) 122 { 123 pColor = (DWORD*)(pDst+(i*3)); 124 *pColor = dwColor; 125 } 126 dwWidth *=3; 127 dwHeight--; 128 129 if(dwWidth == dwPitch) 130 { 131 // Width = Pitch => fill buffer so no need to take care of lines 132 memcpy(pDst+dwPitch, pDst, dwWidth*dwHeight); 133 } 134 else 135 { 136 pFillPos = pDst+dwPitch; 137 while(dwHeight) 138 { 139 memcpy(pFillPos,pDst,dwWidth); 140 pFillPos += dwPitch; 141 dwHeight--; 142 } 143 } 144 } 145 146 void __cdecl Fill32( char* pDst, 147 DWORD dwWidth, 148 DWORD dwHeight, 149 DWORD dwPitch, 150 DWORD dwColor) 151 { 152 DWORD *pColor; 153 char *pFillPos; 154 int i; 155 dprintf(("DDRAW:Fill24 with %08X \n",dwColor)); 156 157 // First Fill First row with the color 158 159 for(i=0 ; i<dwWidth ; i++) 160 { 161 pColor[i] = dwColor; 162 } 163 dwWidth *=4; 164 dwHeight--; 165 166 if(dwWidth == dwPitch) 167 { 168 // Width = Pitch => fill buffer so no need to take care of lines 169 memcpy(pDst+dwPitch, pDst, dwWidth*dwHeight); 170 } 171 else 172 { 173 pFillPos = pDst+dwPitch; 174 while(dwHeight) 175 { 176 memcpy(pFillPos,pDst,dwWidth); 177 pFillPos += dwPitch; 178 dwHeight--; 179 } 180 } 181 } 182 #else 183 #define Fill8 Fill8ASM 184 #define Fill16 Fill16ASM 185 #define Fill24 Fill24ASM 186 #define Fill32 Fill32ASM 187 #endif 188 189 190 191 // without ColorConversion 192 void __cdecl Fill8on8( char *pDB, 141 } 142 //***************************************************************************** 143 //***************************************************************************** 144 void CDECL Fill8on8( char *pDB, 193 145 char *pFB, 194 146 DWORD dwTop, … … 212 164 dwColor); 213 165 } 214 void __cdecl Fill16on16( char *pDB, 166 //***************************************************************************** 167 //***************************************************************************** 168 void CDECL Fill16on16( char *pDB, 215 169 char *pFB, 216 170 DWORD dwTop, … … 234 188 dwColor); 235 189 } 236 void __cdecl Fill24on24( char *pDB, 190 //***************************************************************************** 191 //***************************************************************************** 192 void CDECL Fill24on24( char *pDB, 237 193 char *pFB, 238 194 DWORD dwTop, … … 256 212 257 213 } 258 void __cdecl Fill32on32( char *pDB, 214 //***************************************************************************** 215 //***************************************************************************** 216 void CDECL Fill32on32( char *pDB, 259 217 char *pFB, 260 218 DWORD dwTop, … … 275 233 dwColor); 276 234 } 277 278 void __cdecl Fill8on16( char *pDB, 235 //***************************************************************************** 236 //***************************************************************************** 237 void CDECL Fill8on16( char *pDB, 279 238 char *pFB, 280 239 DWORD dwTop, … … 307 266 dwCol); 308 267 } 309 310 void __cdecl Fill8on24( char *pDB, 268 //***************************************************************************** 269 //***************************************************************************** 270 void CDECL Fill8on24( char *pDB, 311 271 char *pFB, 312 272 DWORD dwTop, … … 339 299 dwCol); 340 300 } 341 void __cdecl Fill8on32( char *pDB, 301 //***************************************************************************** 302 //***************************************************************************** 303 void CDECL Fill8on32( char *pDB, 342 304 char *pFB, 343 305 DWORD dwTop, … … 369 331 dwCol); 370 332 } 371 void __cdecl Fill16on8( char *pDB, 333 //***************************************************************************** 334 //***************************************************************************** 335 void CDECL Fill16on8( char *pDB, 372 336 char *pFB, 373 337 DWORD dwTop, … … 381 345 ) 382 346 { 383 dprintf(("Fill16on8 NOT Implemented \n")); 384 } 385 void __cdecl Fill16on24( char *pDB, 347 dprintf(("Fill16on8 NOT Implemented \n")); 348 DebugInt3(); 349 } 350 //***************************************************************************** 351 //***************************************************************************** 352 void CDECL Fill16on24( char *pDB, 386 353 char *pFB, 387 354 DWORD dwTop, … … 414 381 dwCol); 415 382 } 416 void __cdecl Fill16on32( char *pDB, 383 //***************************************************************************** 384 //***************************************************************************** 385 void CDECL Fill16on32( char *pDB, 417 386 char *pFB, 418 387 DWORD dwTop, … … 445 414 dwCol); 446 415 } 447 448 void __cdecl Fill24on8( char *pDB, 416 //***************************************************************************** 417 //***************************************************************************** 418 void CDECL Fill24on8( char *pDB, 449 419 char *pFB, 450 420 DWORD dwTop, … … 458 428 ) 459 429 { 460 dprintf(("Fill24on8 NOT implemented\n")); 461 } 462 void __cdecl Fill24on16( char *pDB, 430 dprintf(("Fill24on8 NOT implemented\n")); 431 DebugInt3(); 432 } 433 //***************************************************************************** 434 //***************************************************************************** 435 void CDECL Fill24on16( char *pDB, 463 436 char *pFB, 464 437 DWORD dwTop, … … 493 466 dwCol); 494 467 } 495 void __cdecl Fill24on32( char *pDB, 468 //***************************************************************************** 469 //***************************************************************************** 470 void CDECL Fill24on32( char *pDB, 496 471 char *pFB, 497 472 DWORD dwTop, … … 519 494 dwColor); 520 495 } 521 void __cdecl Fill32on8( char *pDB, 496 //***************************************************************************** 497 //***************************************************************************** 498 void CDECL Fill32on8( char *pDB, 522 499 char *pFB, 523 500 DWORD dwTop, … … 531 508 ) 532 509 { 533 dprintf(("Fill32on8 NOT implemented\n")); 534 } 535 void __cdecl Fill32on16( char *pDB, 510 dprintf(("Fill32on8 NOT implemented\n")); 511 DebugInt3(); 512 } 513 //***************************************************************************** 514 //***************************************************************************** 515 void CDECL Fill32on16( char *pDB, 536 516 char *pFB, 537 517 DWORD dwTop, … … 565 545 dwCol); 566 546 } 567 void __cdecl Fill32on24( char *pDB, 547 //***************************************************************************** 548 //***************************************************************************** 549 void CDECL Fill32on24( char *pDB, 568 550 char *pFB, 569 551 DWORD dwTop, … … 590 572 dwColor); 591 573 } 592 574 //***************************************************************************** 575 //***************************************************************************** 576
Note:
See TracChangeset
for help on using the changeset viewer.