comparison tools/lib64fmts.c @ 1764:52e31cfc1e36

Implement fake X raster position for the pixel getting functions. At some point this will be turned into real fullscreen raster position.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 Jun 2018 04:43:05 +0300
parents 847bd77a538d
children cc7b5121c40b
comparison
equal deleted inserted replaced
1763:847bd77a538d 1764:52e31cfc1e36
367 } 367 }
368 368
369 369
370 static Uint8 fmtGetPixelTruePaint( 370 static Uint8 fmtGetPixelTruePaint(
371 const DMC64Image *img, const int bmoffs, const int scroffs, 371 const DMC64Image *img, const int bmoffs, const int scroffs,
372 const int vshift, const int vbitmap, const int raster) 372 const int shift, const int bitmap, const int rasterX, const int rasterY)
373 { 373 {
374 (void) raster; 374 (void) rasterX;
375 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, vshift, 0, vbitmap, 0, img->bgcolor); 375 (void) rasterY;
376 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, 0, bitmap, 0, img->bgcolor);
376 } 377 }
377 378
378 379
379 static int fmtProbeTruePaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 380 static int fmtProbeTruePaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
380 { 381 {
638 } 639 }
639 640
640 641
641 static Uint8 fmtGetPixelFunPaint2( 642 static Uint8 fmtGetPixelFunPaint2(
642 const DMC64Image *img, const int bmoffs, const int scroffs, 643 const DMC64Image *img, const int bmoffs, const int scroffs,
643 const int vshift, const int vbitmap, const int raster) 644 const int shift, const int bitmap, const int rasterX, const int rasterY)
644 { 645 {
645 const int vbank = (raster & 7) + (vbitmap * 8); 646 const int vbank = (rasterY & 7) + (bitmap * 8);
646 int vr, vb; 647 int vr, vb;
647 if (raster < 100) 648 (void) rasterX;
649 if (rasterY < 100)
648 { 650 {
649 vb = 0; 651 vb = 0;
650 vr = raster; 652 vr = rasterY;
651 } 653 }
652 else 654 else
653 { 655 {
654 vb = 0; 656 vb = 0;
655 vr = raster - 100; 657 vr = rasterY - 100;
656 } 658 }
657
658 return dmC64GetGenericMCPixel(
659 img, bmoffs, scroffs, vshift,
660 vbank, vbitmap, 0,
661 img->extraData[vb].data[vr] & 15);
662 }
663
664
665 static Uint8 fmtGetPixelGunPaint(
666 const DMC64Image *img, const int bmoffs, const int scroffs,
667 const int vshift, const int vbitmap, const int raster)
668 {
669 const int vbank = (raster & 7);// + (vbitmap * 8);
670 int vr, vb;
671 if (raster < 177)
672 {
673 vb = 0;
674 vr = raster;
675 }
676 else
677 {
678 vb = 0;
679 vr = raster - 177;
680 }
681
682 return dmC64GetGenericMCPixel(
683 img, bmoffs, scroffs, vshift,
684 vbank, vbitmap, 0,
685 img->extraData[vb].data[vr] & 15);
686 }
687
688
689 static Uint8 fmtGetPixelBFLI(
690 const DMC64Image *img, const int bmoffs, const int scroffs,
691 const int vshift, const int bitmap, const int raster)
692 {
693 const int vbb = bmoffs > 0x1fff ? 1 : 0;
694 const int vbank = (raster & 7) + (vbb * 8);
695 const int vbmoffs = bmoffs & 0x1fff;
696 const int vscroffs = scroffs & 0x3ff;
697
698 //fprintf(stderr, "bmoffs=%d, scroffs=%d, vshift=%d, vbitmap=%d, raster=%d\n", vbmoffs, vscroffs, vshift, vbb, raster);
699 (void) bitmap;
700
701 return dmC64GetGenericMCPixel(
702 img, vbmoffs, vscroffs, vshift,
703 vbank, vbb, 0, img->bgcolor);
704 }
705
706
707 static Uint8 fmtGetPixelBlackMailFLI(
708 const DMC64Image *img, const int bmoffs, const int scroffs,
709 const int shift, const int bitmap, const int raster)
710 {
711 const int vbank = raster & 7;
712 659
713 return dmC64GetGenericMCPixel( 660 return dmC64GetGenericMCPixel(
714 img, bmoffs, scroffs, shift, 661 img, bmoffs, scroffs, shift,
715 vbank, bitmap, 0, 662 vbank, bitmap, 0,
716 img->extraData[0].data[raster] & 15); 663 img->extraData[vb].data[vr] & 15);
664 }
665
666
667 static Uint8 fmtGetPixelGunPaint(
668 const DMC64Image *img, const int bmoffs, const int scroffs,
669 const int shift, const int bitmap, const int rasterX, const int rasterY)
670 {
671 const int vbank = (rasterY & 7);// + (vbitmap * 8);
672 int vr, vb;
673 (void) rasterX;
674 if (rasterY < 177)
675 {
676 vb = 0;
677 vr = rasterY;
678 }
679 else
680 {
681 vb = 0;
682 vr = rasterY - 177;
683 }
684
685 return dmC64GetGenericMCPixel(
686 img, bmoffs, scroffs, shift,
687 vbank, bitmap, 0,
688 img->extraData[vb].data[vr] & 15);
689 }
690
691
692 static Uint8 fmtGetPixelBFLI(
693 const DMC64Image *img, const int bmoffs, const int scroffs,
694 const int shift, const int bitmap, const int rasterX, const int rasterY)
695 {
696 const int vbb = bmoffs > 0x1fff ? 1 : 0;
697 const int vbank = (rasterY & 7) + (vbb * 8);
698 const int vbmoffs = bmoffs & 0x1fff;
699 const int vscroffs = scroffs & 0x3ff;
700
701 //fprintf(stderr, "bmoffs=%d, scroffs=%d, vshift=%d, vbitmap=%d, raster=%d\n", vbmoffs, vscroffs, vshift, vbb, raster);
702 (void) bitmap;
703 (void) rasterX;
704
705 return dmC64GetGenericMCPixel(
706 img, vbmoffs, vscroffs, shift,
707 vbank, vbb, 0, img->bgcolor);
708 }
709
710
711 static Uint8 fmtGetPixelBlackMailFLI(
712 const DMC64Image *img, const int bmoffs, const int scroffs,
713 const int shift, const int bitmap, const int rasterX, const int rasterY)
714 {
715 const int vbank = rasterY & 7;
716 (void) rasterX;
717
718 return dmC64GetGenericMCPixel(
719 img, bmoffs, scroffs, shift,
720 vbank, bitmap, 0,
721 img->extraData[0].data[rasterY] & 15);
717 } 722 }
718 723
719 724
720 static Uint8 fmtGetPixelFLIDesigner( 725 static Uint8 fmtGetPixelFLIDesigner(
721 const DMC64Image *img, const int bmoffs, const int scroffs, 726 const DMC64Image *img, const int bmoffs, const int scroffs,
722 const int shift, const int bitmap, const int raster) 727 const int shift, const int bitmap, const int rasterX, const int rasterY)
723 { 728 {
724 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, raster & 7, bitmap, 0, img->bgcolor); 729 (void) rasterX;
730 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, rasterY & 7, bitmap, 0, img->bgcolor);
725 } 731 }
726 732
727 733
728 static Uint8 fmtGetPixelCrestHIFLIorCDHM( 734 static Uint8 fmtGetPixelCrestHIFLIorCDHM(
729 const DMC64Image *img, const int bmoffs, const int scroffs, 735 const DMC64Image *img, const int bmoffs, const int scroffs,
730 const int shift, const int bitmap, const int raster) 736 const int shift, const int bitmap, const int rasterX, const int rasterY)
731 { 737 {
732 const int vbank = raster & 7; 738 const int vbank = rasterY & 7;
739 (void) rasterX;
733 740
734 if ((img->bitmap[bitmap].data[bmoffs] >> shift) & 1) 741 if ((img->bitmap[bitmap].data[bmoffs] >> shift) & 1)
735 return img->screen[vbank].data[scroffs] >> 4; 742 return img->screen[vbank].data[scroffs] >> 4;
736 else 743 else
737 return img->screen[vbank].data[scroffs] & 15; 744 return img->screen[vbank].data[scroffs] & 15;
749 } 756 }
750 757
751 758
752 static Uint8 fmtGetPixelECI( 759 static Uint8 fmtGetPixelECI(
753 const DMC64Image *img, const int bmoffs, const int scroffs, 760 const DMC64Image *img, const int bmoffs, const int scroffs,
754 const int shift, const int bitmap, const int raster) 761 const int shift, const int bitmap, const int rasterX, const int rasterY)
755 { 762 {
756 const int vbank = raster & 7; 763 const int vbank = rasterY & 7;
757 Uint8 764 Uint8
758 c1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank , 0, 0), 765 c1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank , 0, 0),
759 c2 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank + 8, 1, 0); 766 c2 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank + 8, 1, 0);
760 767
761 (void) bitmap; 768 (void) bitmap;
769 (void) rasterX;
762 return (c1 * C64_NCOLORS) + c2; 770 return (c1 * C64_NCOLORS) + c2;
763 } 771 }
764 772
765 773
766 static int fmtConvertECIBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageFormat *fmt) 774 static int fmtConvertECIBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageFormat *fmt)