Mercurial > hg > dmlib
comparison tools/lib64gfx.h @ 2222:75b5bb490f38
Add & 15 to deeper helper functions and remove it from unnecessary places.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 14 Jun 2019 12:08:59 +0300 |
parents | 90ec1ec89c56 |
children | 5477e792def3 |
comparison
equal
deleted
inserted
replaced
2221:b858ade0fb0b | 2222:75b5bb490f38 |
---|---|
458 const int vshift, const int vbank, const int bitmap, | 458 const int vshift, const int vbank, const int bitmap, |
459 const int cbank, const int bgcolor) | 459 const int cbank, const int bgcolor) |
460 { | 460 { |
461 switch ((img->bitmap[bitmap].data[bmoffs] >> vshift) & 3) | 461 switch ((img->bitmap[bitmap].data[bmoffs] >> vshift) & 3) |
462 { | 462 { |
463 case 0: *col = bgcolor; break; | 463 case 0: *col = bgcolor & 15; break; |
464 case 1: *col = img->screen[vbank].data[scroffs] >> 4; break; | 464 case 1: *col = img->screen[vbank].data[scroffs] >> 4; break; |
465 case 2: *col = img->screen[vbank].data[scroffs] & 15; break; | 465 case 2: *col = img->screen[vbank].data[scroffs] & 15; break; |
466 default: *col = img->color[cbank].data[scroffs] & 15; break; | 466 default: *col = img->color[cbank].data[scroffs] & 15; break; |
467 } | 467 } |
468 | 468 |
482 chr); | 482 chr); |
483 } | 483 } |
484 | 484 |
485 const int vshift = 7 - (rasterX & 7); | 485 const int vshift = 7 - (rasterX & 7); |
486 if ((img->charData[chrbank].data[chroffs] >> vshift) & 1) | 486 if ((img->charData[chrbank].data[chroffs] >> vshift) & 1) |
487 *col = img->color[cbank].data[scroffs]; | 487 *col = img->color[cbank].data[scroffs] & 15; |
488 else | 488 else |
489 *col = bgcolor; | 489 *col = bgcolor & 15; |
490 | 490 |
491 return DMERR_OK; | 491 return DMERR_OK; |
492 } | 492 } |
493 | 493 |
494 | 494 |
509 if (ccol & 8) | 509 if (ccol & 8) |
510 { | 510 { |
511 const int vshift = 6 - (rasterX & 6); | 511 const int vshift = 6 - (rasterX & 6); |
512 switch ((img->charData[chrbank].data[chroffs] >> vshift) & 3) | 512 switch ((img->charData[chrbank].data[chroffs] >> vshift) & 3) |
513 { | 513 { |
514 case 0: *col = bgcolor; break; | 514 case 0: *col = bgcolor & 15; break; |
515 case 1: *col = bgd022; break; | 515 case 1: *col = bgd022 & 15; break; |
516 case 2: *col = bgd023; break; | 516 case 2: *col = bgd023 & 15; break; |
517 case 3: *col = ccol & 7; | 517 case 3: *col = ccol & 7; |
518 } | 518 } |
519 } | 519 } |
520 else | 520 else |
521 { | 521 { |
522 const int vshift = 7 - (rasterX & 7); | 522 const int vshift = 7 - (rasterX & 7); |
523 if ((img->charData[chrbank].data[chroffs] >> vshift) & 1) | 523 if ((img->charData[chrbank].data[chroffs] >> vshift) & 1) |
524 *col = ccol & 7; | 524 *col = ccol & 7; |
525 else | 525 else |
526 *col = bgcolor; | 526 *col = bgcolor & 15; |
527 } | 527 } |
528 | 528 |
529 return DMERR_OK; | 529 return DMERR_OK; |
530 } | 530 } |
531 | 531 |
547 if ((img->charData[chrbank].data[chroffs] >> vshift) & 1) | 547 if ((img->charData[chrbank].data[chroffs] >> vshift) & 1) |
548 *col = img->color[cbank].data[scroffs] & 15; | 548 *col = img->color[cbank].data[scroffs] & 15; |
549 else | 549 else |
550 switch ((chr >> 6) & 3) | 550 switch ((chr >> 6) & 3) |
551 { | 551 { |
552 case 0: *col = bgcolor; break; | 552 case 0: *col = bgcolor & 15; break; |
553 case 1: *col = bgd022; break; | 553 case 1: *col = bgd022 & 15; break; |
554 case 2: *col = bgd023; break; | 554 case 2: *col = bgd023 & 15; break; |
555 case 3: *col = bgd024; break; | 555 case 3: *col = bgd024 & 15; break; |
556 } | 556 } |
557 | 557 |
558 return DMERR_OK; | 558 return DMERR_OK; |
559 } | 559 } |
560 | 560 |