Mercurial > hg > dmlib
comparison tools/lib64fmts.c @ 2121:f12ac487954b
Rename the "shift" variable/function argument used for bitshift of c64 bitmap/char pixels.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 27 May 2019 00:04:02 +0300 |
parents | 88d37ec1b4d6 |
children | 56d4dc81774b |
comparison
equal
deleted
inserted
replaced
2120:88d37ec1b4d6 | 2121:f12ac487954b |
---|---|
474 } | 474 } |
475 | 475 |
476 | 476 |
477 static Uint8 fmtGetPixelFLIDesigner( | 477 static Uint8 fmtGetPixelFLIDesigner( |
478 const DMC64Image *img, const int bmoffs, const int scroffs, | 478 const DMC64Image *img, const int bmoffs, const int scroffs, |
479 const int shift, const int bitmap, const int rasterX, const int rasterY) | 479 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
480 { | 480 { |
481 (void) rasterX; | 481 (void) rasterX; |
482 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, rasterY & 7, bitmap, 0, img->bgcolor); | 482 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shiftX, rasterY & 7, bitmap, 0, img->bgcolor); |
483 } | 483 } |
484 | 484 |
485 | 485 |
486 static int fmtProbeBlackMailFLIPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) | 486 static int fmtProbeBlackMailFLIPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) |
487 { | 487 { |
565 } | 565 } |
566 | 566 |
567 | 567 |
568 static Uint8 fmtGetPixelBlackMailFLI( | 568 static Uint8 fmtGetPixelBlackMailFLI( |
569 const DMC64Image *img, const int bmoffs, const int scroffs, | 569 const DMC64Image *img, const int bmoffs, const int scroffs, |
570 const int shift, const int bitmap, const int rasterX, const int rasterY) | 570 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
571 { | 571 { |
572 const int vbank = rasterY & 7; | 572 const int vbank = rasterY & 7; |
573 (void) rasterX; | 573 (void) rasterX; |
574 | 574 |
575 return dmC64GetGenericMCPixel( | 575 return dmC64GetGenericMCPixel( |
576 img, bmoffs, scroffs, shift, | 576 img, bmoffs, scroffs, shiftX, |
577 vbank, bitmap, 0, | 577 vbank, bitmap, 0, |
578 img->extraData[0].data[rasterY] & 15); | 578 img->extraData[0].data[rasterY] & 15); |
579 } | 579 } |
580 | 580 |
581 | 581 |
590 } | 590 } |
591 | 591 |
592 | 592 |
593 static Uint8 fmtGetPixelTruePaint( | 593 static Uint8 fmtGetPixelTruePaint( |
594 const DMC64Image *img, const int bmoffs, const int scroffs, | 594 const DMC64Image *img, const int bmoffs, const int scroffs, |
595 const int shift, const int bitmap, const int rasterX, const int rasterY) | 595 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
596 { | 596 { |
597 (void) rasterX; | 597 (void) rasterX; |
598 (void) rasterY; | 598 (void) rasterY; |
599 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, 0, bitmap, 0, img->bgcolor); | 599 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shiftX, 0, bitmap, 0, img->bgcolor); |
600 } | 600 } |
601 | 601 |
602 | 602 |
603 static int fmtProbeTruePaintPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) | 603 static int fmtProbeTruePaintPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) |
604 { | 604 { |
891 } | 891 } |
892 | 892 |
893 | 893 |
894 static Uint8 fmtGetPixelFunPaint2( | 894 static Uint8 fmtGetPixelFunPaint2( |
895 const DMC64Image *img, const int bmoffs, const int scroffs, | 895 const DMC64Image *img, const int bmoffs, const int scroffs, |
896 const int shift, const int bitmap, const int rasterX, const int rasterY) | 896 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
897 { | 897 { |
898 const int vbank = (rasterY & 7) + (bitmap * 8); | 898 const int vbank = (rasterY & 7) + (bitmap * 8); |
899 (void) rasterX; | 899 (void) rasterX; |
900 | 900 |
901 return dmC64GetGenericMCPixel( | 901 return dmC64GetGenericMCPixel( |
902 img, bmoffs, scroffs, shift, | 902 img, bmoffs, scroffs, shiftX, |
903 vbank, bitmap, 0, | 903 vbank, bitmap, 0, |
904 img->extraData[0].data[rasterY] & 15); | 904 img->extraData[0].data[rasterY] & 15); |
905 } | 905 } |
906 | 906 |
907 | 907 |
908 static Uint8 fmtGetPixelBFLI( | 908 static Uint8 fmtGetPixelBFLI( |
909 const DMC64Image *img, const int bmoffs, const int scroffs, | 909 const DMC64Image *img, const int bmoffs, const int scroffs, |
910 const int shift, const int bitmap, const int rasterX, const int rasterY) | 910 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
911 { | 911 { |
912 const int vbb = rasterY < 200 ? 0 : 1; | 912 const int vbb = rasterY < 200 ? 0 : 1; |
913 const int vbank = (rasterY & 7) + (vbb * 8); | 913 const int vbank = (rasterY & 7) + (vbb * 8); |
914 (void) bitmap; | 914 (void) bitmap; |
915 (void) rasterX; | 915 (void) rasterX; |
916 | 916 |
917 return dmC64GetGenericMCPixel( | 917 return dmC64GetGenericMCPixel( |
918 img, bmoffs & 0x1fff, scroffs & 0x3ff, | 918 img, bmoffs & 0x1fff, scroffs & 0x3ff, |
919 shift, vbank, vbb, 0, img->bgcolor); | 919 shiftX, vbank, vbb, 0, img->bgcolor); |
920 } | 920 } |
921 | 921 |
922 | 922 |
923 static Uint8 fmtGetPixelPentelPaint( | 923 static Uint8 fmtGetPixelPentelPaint( |
924 const DMC64Image *img, const int bmoffs, const int scroffs, | 924 const DMC64Image *img, const int bmoffs, const int scroffs, |
925 const int shift, const int bitmap, const int rasterX, const int rasterY) | 925 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
926 { | 926 { |
927 const int ry = rasterY / C64_SPR_HEIGHT_PX; | 927 const int ry = rasterY / C64_SPR_HEIGHT_PX; |
928 const int yd = rasterY % C64_SPR_HEIGHT_PX; | 928 const int yd = rasterY % C64_SPR_HEIGHT_PX; |
929 const int rx = rasterX / C64_SPR_WIDTH_PX; | 929 const int rx = rasterX / C64_SPR_WIDTH_PX; |
930 const int xd = rasterX % C64_SPR_WIDTH_PX; | 930 const int xd = rasterX % C64_SPR_WIDTH_PX; |
931 const int offs = (ry * 8 + rx) * C64_SPR_SIZE + (yd * C64_SPR_WIDTH_UT) + (xd / 8); | 931 const int offs = (ry * 8 + rx) * C64_SPR_SIZE + (yd * C64_SPR_WIDTH_UT) + (xd / 8); |
932 const int mask = 1 << (7 - (rasterX & 7)); | 932 const int mask = 1 << (7 - (rasterX & 7)); |
933 | 933 |
934 Uint8 color1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, 0, bitmap, 0); | 934 Uint8 color1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shiftX, 0, bitmap, 0); |
935 Uint8 color2 = img->extraData[0].data[offs] & mask ? 0x0f : 0; | 935 Uint8 color2 = img->extraData[0].data[offs] & mask ? 0x0f : 0; |
936 Uint8 color3 = img->extraData[0].data[offs + C64_SPR_SIZE * 155] & mask ? img->d022 : 0; | 936 Uint8 color3 = img->extraData[0].data[offs + C64_SPR_SIZE * 155] & mask ? img->d022 : 0; |
937 | 937 |
938 return color3 ? color3 : ( color2 ? color2 : color1 ); | 938 return color3 ? color3 : ( color2 ? color2 : color1 ); |
939 } | 939 } |
940 | 940 |
941 | 941 |
942 static Uint8 fmtGetPixelHCB( | 942 static Uint8 fmtGetPixelHCB( |
943 const DMC64Image *img, const int bmoffs, const int scroffs, | 943 const DMC64Image *img, const int bmoffs, const int scroffs, |
944 const int shift, const int bitmap, const int rasterX, const int rasterY) | 944 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
945 { | 945 { |
946 const int vbank = (rasterY / 4) & 1; | 946 const int vbank = (rasterY / 4) & 1; |
947 (void) bitmap; | 947 (void) bitmap; |
948 (void) rasterX; | 948 (void) rasterX; |
949 | 949 |
950 return dmC64GetGenericMCPixel( | 950 return dmC64GetGenericMCPixel( |
951 img, bmoffs, scroffs, | 951 img, bmoffs, scroffs, |
952 shift, vbank, 0, vbank, | 952 shiftX, vbank, 0, vbank, |
953 img->extraData[0].data[rasterY / 5] & 15); | 953 img->extraData[0].data[rasterY / 5] & 15); |
954 } | 954 } |
955 | 955 |
956 | 956 |
957 static Uint8 fmtGetPixelCrestHIFLIorCDHM( | 957 static Uint8 fmtGetPixelCrestHIFLIorCDHM( |
958 const DMC64Image *img, const int bmoffs, const int scroffs, | 958 const DMC64Image *img, const int bmoffs, const int scroffs, |
959 const int shift, const int bitmap, const int rasterX, const int rasterY) | 959 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
960 { | 960 { |
961 (void) rasterX; | 961 (void) rasterX; |
962 return dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, rasterY & 7, bitmap, 0); | 962 return dmC64GetGenericSCPixel(img, bmoffs, scroffs, shiftX, rasterY & 7, bitmap, 0); |
963 } | 963 } |
964 | 964 |
965 | 965 |
966 static int fmtECIGetLaceType(const DMC64EncDecOp *op, DMC64Image *img, | 966 static int fmtECIGetLaceType(const DMC64EncDecOp *op, DMC64Image *img, |
967 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt) | 967 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt) |
974 } | 974 } |
975 | 975 |
976 | 976 |
977 static Uint8 fmtGetPixelECI( | 977 static Uint8 fmtGetPixelECI( |
978 const DMC64Image *img, const int bmoffs, const int scroffs, | 978 const DMC64Image *img, const int bmoffs, const int scroffs, |
979 const int shift, const int bitmap, const int rasterX, const int rasterY) | 979 const int shiftX, const int bitmap, const int rasterX, const int rasterY) |
980 { | 980 { |
981 const int vbank = rasterY & 7; | 981 const int vbank = rasterY & 7; |
982 Uint8 | 982 Uint8 |
983 c1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank , 0, 0), | 983 c1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shiftX, vbank , 0, 0), |
984 c2 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank + 8, 1, 0); | 984 c2 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shiftX, vbank + 8, 1, 0); |
985 | 985 |
986 (void) bitmap; | 986 (void) bitmap; |
987 (void) rasterX; | 987 (void) rasterX; |
988 return (c1 * C64_NCOLORS) + c2; | 988 return (c1 * C64_NCOLORS) + c2; |
989 } | 989 } |