Mercurial > hg > dmlib
comparison lib64gfx.c @ 810:cbe263ad963c
Some work on charset conversion.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 15 May 2014 02:05:53 +0300 |
parents | 5d158c4321bb |
children | aebc2f8b2c2d |
comparison
equal
deleted
inserted
replaced
809:eba3b87f3f84 | 810:cbe263ad963c |
---|---|
701 // Convert a generic "C64" format bitmap in DMC64Image struct to | 701 // Convert a generic "C64" format bitmap in DMC64Image struct to |
702 // a indexed/paletted bitmap image. | 702 // a indexed/paletted bitmap image. |
703 int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const BOOL doubleMC) | 703 int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const BOOL doubleMC) |
704 { | 704 { |
705 Uint8 *dp = dst->data; | 705 Uint8 *dp = dst->data; |
706 int divisor = doubleMC ? 4 : 8, | 706 int yc; |
707 wdivisor = doubleMC ? 2 : 1, | |
708 yc; | |
709 | 707 |
710 // Sanity check arguments | 708 // Sanity check arguments |
711 if (dst == NULL || src == NULL) | 709 if (dst == NULL || src == NULL) |
712 return DMERR_NULLPTR; | 710 return DMERR_NULLPTR; |
713 | 711 |
738 *d++ = src->screen[0][scroffs] & 15; | 736 *d++ = src->screen[0][scroffs] & 15; |
739 } | 737 } |
740 } | 738 } |
741 else | 739 else |
742 { | 740 { |
741 const int | |
742 wdivisor = doubleMC ? 2 : 1, | |
743 divisor = doubleMC ? 4 : 8; | |
744 | |
743 for (xc = 0; xc < dst->width / wdivisor; xc++) | 745 for (xc = 0; xc < dst->width / wdivisor; xc++) |
744 { | 746 { |
745 const int x = xc / divisor; | 747 const int x = xc / divisor; |
746 const int scroffs = scroffsy + x; | 748 const int scroffs = scroffsy + x; |
747 const int bmoffs = bmoffsy + (x * 8) + yb; | 749 const int bmoffs = bmoffsy + (x * 8) + yb; |
763 vbank = yb; | 765 vbank = yb; |
764 break; | 766 break; |
765 } | 767 } |
766 c = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, vbank, scroffs); | 768 c = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, vbank, scroffs); |
767 *d++ = c; | 769 *d++ = c; |
768 *d++ = c; | 770 if (doubleMC) |
771 *d++ = c; | |
769 } | 772 } |
770 else | 773 else |
771 if (src->type & D64_FMT_ILACE) | 774 if (src->type & D64_FMT_ILACE) |
772 { | 775 { |
773 *d++ = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, src->laceBank1, scroffs); | 776 *d++ = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, src->laceBank1, scroffs); |
774 *d++ = dmC64GetMCColor(src, (src->bitmap[1][bmoffs] >> v) & 3, 0, src->laceBank2, scroffs); | 777 if (doubleMC) |
778 *d++ = dmC64GetMCColor(src, (src->bitmap[1][bmoffs] >> v) & 3, 0, src->laceBank2, scroffs); | |
775 } | 779 } |
776 else | 780 else |
777 { | 781 { |
778 c = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, 0, scroffs); | 782 c = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, 0, scroffs); |
779 *d++ = c; | 783 *d++ = c; |
780 *d++ = c; | 784 if (doubleMC) |
785 *d++ = c; | |
781 } | 786 } |
782 } | 787 } |
783 } | 788 } |
784 dp += dst->pitch; | 789 dp += dst->pitch; |
785 } | 790 } |