Mercurial > hg > dmlib
comparison tools/libgfx.c @ 1899:54baa688425b
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 26 Jun 2018 04:31:39 +0300 |
parents | 50dbfc10f49f |
children | 8c6040d5b930 |
comparison
equal
deleted
inserted
replaced
1898:50dbfc10f49f | 1899:54baa688425b |
---|---|
1575 { | 1575 { |
1576 return (buf[xc / 8] >> (7 - (xc & 7))) & 1; | 1576 return (buf[xc / 8] >> (7 - (xc & 7))) & 1; |
1577 } | 1577 } |
1578 | 1578 |
1579 | 1579 |
1580 static void dmDecodeBitPlane(Uint8 *dst, const Uint8 *src, const int width, const int nplane) | |
1581 { | |
1582 for (int xc = 0; xc < width; xc++) | |
1583 dst[xc] |= dmDecodeBit(src, xc) << nplane; | |
1584 } | |
1585 | |
1586 | |
1587 static int dmDecodeILBMBody(DMResource *fp, DMIFF *iff, DMImage *img) | 1580 static int dmDecodeILBMBody(DMResource *fp, DMIFF *iff, DMImage *img) |
1588 { | 1581 { |
1589 Uint8 *buf; | 1582 Uint8 *buf; |
1590 size_t bufLen; | 1583 size_t bufLen; |
1591 int res = DMERR_OK; | 1584 int res = DMERR_OK; |
1615 plane, yc); | 1608 plane, yc); |
1616 goto error; | 1609 goto error; |
1617 } | 1610 } |
1618 | 1611 |
1619 // Decode bitplane | 1612 // Decode bitplane |
1620 dmDecodeBitPlane(dp, buf, img->width, plane); | 1613 for (int xc = 0; xc < img->width; xc++) |
1614 dp[xc] |= dmDecodeBit(buf, xc) << plane; | |
1621 } | 1615 } |
1622 | 1616 |
1623 // Read mask data | 1617 // Read mask data |
1624 if (iff->bmhd.masking == IFF_MASK_HAS_MASK) | 1618 if (iff->bmhd.masking == IFF_MASK_HAS_MASK) |
1625 { | 1619 { |
2000 } | 1994 } |
2001 | 1995 |
2002 | 1996 |
2003 BOOL dmIFFEncodeByteRun1Row(DMResource *fp, const Uint8 *buf, const size_t bufLen) | 1997 BOOL dmIFFEncodeByteRun1Row(DMResource *fp, const Uint8 *buf, const size_t bufLen) |
2004 { | 1998 { |
2005 size_t l_offs = 0, offs = 0; | |
2006 unsigned int r_count = 0; | 1999 unsigned int r_count = 0; |
2007 int prev = -1, mode = DMODE_LIT; | 2000 int prev = -1, mode = DMODE_LIT; |
2001 size_t offs, l_offs = 0; | |
2008 | 2002 |
2009 for (offs = 0; offs < bufLen; offs++) | 2003 for (offs = 0; offs < bufLen; offs++) |
2010 { | 2004 { |
2011 Uint8 data = buf[offs]; | 2005 Uint8 data = buf[offs]; |
2012 int next_mode; | 2006 int next_mode; |