Commit 2e0c3993 authored by Jeffrey Lee's avatar Jeffrey Lee

Fix incorrect calculation of memory requirements for alpha-masked sprites

Detail:
  c/PSprite - Fix psprite_size to correctly calculate the memory required by alpha masks
Admin:
  Tested on Raspberry Pi
  Fixes issue reported on forums with 'Not enough memory' errors from SpriteExtend when resizing or adding rows/columns to alpha-masked sprites: https://www.riscosopen.org/forum/forums/4/topics/3610


Version 2.19. Tagged as 'Paint-2_19'
parent b10e0ce4
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.18"
Module_Version SETA 218
Module_MajorVersion SETS "2.19"
Module_Version SETA 219
Module_MinorVersion SETS ""
Module_Date SETS "01 Jun 2015"
Module_ApplicationDate SETS "01-Jun-15"
Module_Date SETS "26 Sep 2015"
Module_ApplicationDate SETS "26-Sep-15"
Module_ComponentName SETS "Paint"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Paint"
Module_FullVersion SETS "2.18"
Module_HelpVersion SETS "2.18 (01 Jun 2015)"
Module_FullVersion SETS "2.19"
Module_HelpVersion SETS "2.19 (26 Sep 2015)"
END
/* (2.18)
/* (2.19)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.18
#define Module_MajorVersion_CMHG 2.19
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 01 Jun 2015
#define Module_Date_CMHG 26 Sep 2015
#define Module_MajorVersion "2.18"
#define Module_Version 218
#define Module_MajorVersion "2.19"
#define Module_Version 219
#define Module_MinorVersion ""
#define Module_Date "01 Jun 2015"
#define Module_Date "26 Sep 2015"
#define Module_ApplicationDate "01-Jun-15"
#define Module_ApplicationDate "26-Sep-15"
#define Module_ComponentName "Paint"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Paint"
#define Module_FullVersion "2.18"
#define Module_HelpVersion "2.18 (01 Jun 2015)"
#define Module_LibraryVersionInfo "2:18"
#define Module_FullVersion "2.19"
#define Module_HelpVersion "2.19 (26 Sep 2015)"
#define Module_LibraryVersionInfo "2:19"
......@@ -213,11 +213,20 @@ int psprite_size (int width, int height, int mode, int mask, int palette)
}
if ((unsigned) mode < 256u)
{
/*Old-format sprite.*/
spritesize += spritesize;
}
else if (mode & 0x80000000)
{
/*8bpp alpha mask.*/
spritesize += height*((width+3)&~3);
}
else
{
/*New format sprite - 1bpp mask.*/
spritesize += height*(width + 31 >> 5 << 2);
}
}
spritesize += sizeof (sprite_header) + palsize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment