Fix to gImage BMP handling where the system pixel size is less than a byte

This commit is contained in:
inmarket 2019-05-08 09:25:35 +10:00
parent 127a7cd2a2
commit 0586fd276d
3 changed files with 14 additions and 2 deletions

View File

@ -4,6 +4,8 @@
*** After Release 2.9 *** *** After Release 2.9 ***
CHANGE: Added type gImage to replace V2.x gdispImage CHANGE: Added type gImage to replace V2.x gdispImage
FIX: Fixed GWIN console widget scroll
FIX: A warning and adjusted is made if GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE is less than 40 bytes.
*** Release 2.9 *** *** Release 2.9 ***

View File

@ -11,6 +11,16 @@
#include "gdisp_image_support.h" #include "gdisp_image_support.h"
#if GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE * (COLOR_TYPE_BITS/8) < 40
#if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
#warning "GDISP: GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE must be at least 40 bytes. It has been adjusted for you."
#elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
COMPILER_WARNING("GDISP: GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE must be at least 40 bytes. It has been adjusted for you.")
#endif
#undef GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE
#define GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE ((40 + (COLOR_TYPE_BITS/8) - 1) / (COLOR_TYPE_BITS/8))
#endif
typedef struct gdispImagePrivate_BMP { typedef struct gdispImagePrivate_BMP {
gU8 bmpflags; gU8 bmpflags;
#define BMP_V2 0x01 // Version 2 (old) header format #define BMP_V2 0x01 // Version 2 (old) header format

View File

@ -389,8 +389,8 @@
#define GDISP_NEED_IMAGE_BMP_32 GFXON #define GDISP_NEED_IMAGE_BMP_32 GFXON
#endif #endif
/** /**
* @brief The BMP blit buffer size. * @brief The BMP blit buffer size in pixels.
* @details Defaults to 32 * @details Defaults to 32 pixels
* @note Bigger is faster but requires more RAM. * @note Bigger is faster but requires more RAM.
* @note This must be greater than 40 bytes and 32 pixels as we read our headers into this space as well. * @note This must be greater than 40 bytes and 32 pixels as we read our headers into this space as well.
*/ */