Browse Source

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

remotes/origin/master
inmarket 2 years ago
parent
commit
0586fd276d
  1. 2
      changelog.txt
  2. 10
      src/gdisp/gdisp_image_bmp.c
  3. 4
      src/gdisp/gdisp_options.h

2
changelog.txt

@ -4,6 +4,8 @@
*** After Release 2.9 ***
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 ***

10
src/gdisp/gdisp_image_bmp.c

@ -11,6 +11,16 @@
#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 {
gU8 bmpflags;
#define BMP_V2 0x01 // Version 2 (old) header format

4
src/gdisp/gdisp_options.h

@ -389,8 +389,8 @@
#define GDISP_NEED_IMAGE_BMP_32 GFXON
#endif
/**
* @brief The BMP blit buffer size.
* @details Defaults to 32
* @brief The BMP blit buffer size in pixels.
* @details Defaults to 32 pixels
* @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.
*/

Loading…
Cancel
Save