comparison tools/libgfx.c @ 1659:99b8ab61dc1b

Micro-optimization.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 May 2018 14:45:14 +0300
parents c005d84e9bf8
children dbffbd333a16
comparison
equal deleted inserted replaced
1658:c005d84e9bf8 1659:99b8ab61dc1b
1634 static int dmDecodeILBMBody(DMResource *fp, DMIFF *iff, DMImage *img, Uint32 *read) 1634 static int dmDecodeILBMBody(DMResource *fp, DMIFF *iff, DMImage *img, Uint32 *read)
1635 { 1635 {
1636 Uint8 *buf; 1636 Uint8 *buf;
1637 size_t bufLen; 1637 size_t bufLen;
1638 int res = DMERR_OK; 1638 int res = DMERR_OK;
1639 const int nplanes = iff->bmhd.nplanes;
1639 1640
1640 *read = 0; 1641 *read = 0;
1641 1642
1642 // Allocate planar decoding buffer 1643 // Allocate planar decoding buffer
1643 bufLen = ((img->width + 15) / 16) * 2; 1644 bufLen = ((img->width + 15) / 16) * 2;
1647 dmMsg(2, "ILBM: plane row size %d bytes.\n", bufLen); 1648 dmMsg(2, "ILBM: plane row size %d bytes.\n", bufLen);
1648 1649
1649 // Decode the chunk 1650 // Decode the chunk
1650 for (int yc = 0; yc < img->height; yc++) 1651 for (int yc = 0; yc < img->height; yc++)
1651 { 1652 {
1652 const int nplanes = iff->bmhd.nplanes;
1653 Uint8 *dp = img->data + (yc * img->pitch); 1653 Uint8 *dp = img->data + (yc * img->pitch);
1654 1654
1655 dmMemset(dp, 0, img->pitch); 1655 dmMemset(dp, 0, img->pitch);
1656 1656
1657 for (int plane = 0; plane < nplanes; plane++) 1657 for (int plane = 0; plane < nplanes; plane++)