Mercurial > hg > dmlib
comparison tools/lib64fmts.c @ 2313:866e036d7706
Clean up some code duplication.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 09 Jul 2019 11:52:15 +0300 |
parents | d0608fbd85bc |
children | 87533af8db64 |
comparison
equal
deleted
inserted
replaced
2312:cd266022e4a8 | 2313:866e036d7706 |
---|---|
454 | 454 |
455 | 455 |
456 static int fmtGetPixelDrazLace(Uint8 *col, | 456 static int fmtGetPixelDrazLace(Uint8 *col, |
457 const DMC64Image *img, const int rasterX, const int rasterY) | 457 const DMC64Image *img, const int rasterX, const int rasterY) |
458 { | 458 { |
459 const int | 459 DM_C64_GENERIC_SC_PIXEL_DEFS(img) |
460 x = rasterX / 8, | 460 (void) vshift; |
461 y = rasterY / 8, | |
462 yoffs = y * img->fmt->chWidth, | |
463 bmoffs = yoffs * 8 + (rasterY & 7) + (x * 8), | |
464 scroffs = yoffs + x, | |
465 vshift = 6 - (rasterX & 6); | |
466 | 461 |
467 return dmC64GetGenericMCPixel(col, img, | 462 return dmC64GetGenericMCPixel(col, img, |
468 bmoffs, scroffs, | 463 bmoffs, scroffs, |
469 vshift, 0, | 464 6 - (rasterX & 6), 0, |
470 rasterX & 1, 0, img->bgcolor); | 465 rasterX & 1, 0, img->bgcolor); |
471 } | 466 } |
472 | 467 |
473 | 468 |
474 static const char *fmtBDP5_MagicID = "BDP 5.00"; | 469 static const char *fmtBDP5_MagicID = "BDP 5.00"; |
790 | 785 |
791 | 786 |
792 static int fmtGetPixelTruePaint(Uint8 *col, | 787 static int fmtGetPixelTruePaint(Uint8 *col, |
793 const DMC64Image *img, const int rasterX, const int rasterY) | 788 const DMC64Image *img, const int rasterX, const int rasterY) |
794 { | 789 { |
795 const int | 790 DM_C64_GENERIC_SC_PIXEL_DEFS(img) |
796 x = rasterX / 8, | 791 (void) vshift; |
797 y = rasterY / 8, | |
798 yoffs = y * img->fmt->chWidth, | |
799 bmoffs = yoffs * 8 + (rasterY & 7) + (x * 8), | |
800 scroffs = yoffs + x, | |
801 vshift = 6 - (rasterX & 6); | |
802 | 792 |
803 return dmC64GetGenericMCPixel(col, img, | 793 return dmC64GetGenericMCPixel(col, img, |
804 bmoffs, scroffs, | 794 bmoffs, scroffs, |
805 vshift, 0, | 795 6 - (rasterX & 6), 0, |
806 rasterX & 1, 0, img->bgcolor); | 796 rasterX & 1, 0, img->bgcolor); |
807 } | 797 } |
808 | 798 |
809 | 799 |
810 static int fmtProbeTruePaintPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) | 800 static int fmtProbeTruePaintPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) |