comparison tools/lib64gfx.c @ 2518:470631c00c97

Implement optionality of loading address in dmC64EncodeBMP() as well.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 May 2020 20:49:12 +0300
parents 5fcc9f7b8ad8
children c6ee41fd98dd
comparison
equal deleted inserted replaced
2517:106f4426c729 2518:470631c00c97
1629 1629
1630 // Allocate a buffer 1630 // Allocate a buffer
1631 if ((res = dmGrowBufAlloc(buf, BUF_SIZE_INITIAL, BUF_SIZE_GROW)) != DMERR_OK) 1631 if ((res = dmGrowBufAlloc(buf, BUF_SIZE_INITIAL, BUF_SIZE_GROW)) != DMERR_OK)
1632 goto out; 1632 goto out;
1633 1633
1634 // Add the loading address 1634 // Add the loading address, if needed
1635 if (!dmGrowBufPutU16LE(buf, fmt->addr)) 1635 if (fmt->addr >= 0 &&
1636 !dmGrowBufPutU16LE(buf, fmt->addr))
1637 {
1638 res = DMERR_MALLOC;
1636 goto out; 1639 goto out;
1640 }
1637 1641
1638 // Attempt to encode the image to a buffer 1642 // Attempt to encode the image to a buffer
1639 if (fmt->encode != NULL) 1643 if (fmt->encode != NULL)
1640 res = fmt->encode(buf, img, fmt); 1644 res = fmt->encode(buf, img, fmt);
1641 else 1645 else