feat(draw_sw): add RGB565_SWAPPED support (#8227)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
@@ -0,0 +1,73 @@
|
||||
#ifdef __has_include
|
||||
#if __has_include("lvgl.h")
|
||||
#ifndef LV_LVGL_H_INCLUDE_SIMPLE
|
||||
#define LV_LVGL_H_INCLUDE_SIMPLE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "lvgl/lvgl.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
#endif
|
||||
|
||||
#ifndef LV_ATTRIBUTE_IMG_RENDER_LVGL_LOGO_RGB565_SWAPPED
|
||||
#define LV_ATTRIBUTE_IMG_RENDER_LVGL_LOGO_RGB565_SWAPPED
|
||||
#endif
|
||||
|
||||
static const
|
||||
LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_RENDER_LVGL_LOGO_RGB565_SWAPPED
|
||||
uint8_t img_render_lvgl_logo_rgb565_swapped_map[] = {
|
||||
|
||||
0xff,0xff,0xff,0xff,0xbd,0xd7,0x7b,0xcf,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x73,0xae,0x94,0x92,0xef,0x5d,0xff,0xff,
|
||||
0xff,0xff,0x94,0xb2,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x29,0x86,0x21,0x45,0x21,0x45,0x29,0x66,0x4a,0x8a,0xde,0xfb,
|
||||
0xbd,0xf7,0x29,0x86,0x31,0xa6,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x29,0x86,0x5b,0x0c,0x6b,0x4d,0x31,0xa6,0x21,0x45,0x63,0x4d,
|
||||
0x7b,0xcf,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x29,0x65,0x7b,0xcf,0xff,0xdf,0xff,0xff,0x9c,0xf3,0x29,0x65,0x42,0x28,
|
||||
0x73,0xae,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x21,0x45,0xad,0x96,0xff,0xff,0xff,0xff,0xde,0xdb,0x29,0x86,0x3a,0x08,
|
||||
0x73,0xae,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x29,0x86,0x5b,0x0c,0xef,0x5d,0xf7,0x9e,0x7c,0x10,0x29,0x65,0x42,0x28,
|
||||
0x73,0xae,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x29,0x86,0x42,0x28,0x42,0x49,0x29,0x86,0x31,0xa6,0x42,0x28,
|
||||
0x73,0x8e,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x29,0x86,0x29,0x86,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0x7c,0x10,0x21,0x45,0x21,0x45,0x21,0x45,0x21,0x45,0x21,0x45,0x21,0x45,0x21,0x45,0x21,0x45,0x29,0x66,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xef,0x7d,0xad,0x96,0xa5,0x55,0xa5,0x76,0xa5,0x76,0xa5,0x76,0xa5,0x76,0xa5,0x76,0xa5,0x55,0x63,0x4d,0x29,0x66,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xff,0xff,0xfe,0xf9,0xfe,0xd8,0xfe,0xd8,0xfe,0xd8,0xfe,0xd8,0xfe,0xd8,0xfe,0xd8,0xff,0x1a,0xff,0xff,0x73,0xcf,0x29,0x65,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xfd,0x30,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0x81,0xfe,0x77,0xc6,0x7a,0x29,0x65,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xf4,0x6c,0xf2,0xc3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0x82,0xfd,0xf3,0xc6,0x9a,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xf4,0x8c,0xf2,0xc3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xa2,0xfd,0xf4,0xc6,0x7a,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xf4,0x8c,0xf2,0xc3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xa2,0xfd,0xf4,0xc6,0x7a,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xf4,0x8c,0xf2,0xc3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xa2,0xfd,0xf4,0xc6,0x7a,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xf4,0x8c,0xf2,0xc3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xa2,0xfd,0xf4,0xc6,0x7a,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xf4,0x8c,0xf2,0xc3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xe3,0xf2,0xa2,0xfd,0xf4,0xc6,0x7a,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xf4,0x6c,0xf2,0x81,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0xa2,0xf2,0x60,0xfd,0xf4,0xc6,0x7a,0x21,0x24,0x29,0x65,0x29,0x65,0x29,0x65,0x29,0x65,0x29,0x65,0x29,0x65,0x29,0x65,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xfe,0x98,0xf4,0x4b,0xf4,0x2a,0xf4,0x2b,0xf4,0x2b,0xf4,0x2b,0xf4,0x2b,0xf4,0x2a,0xf4,0x4b,0xff,0x3b,0xf7,0xbe,0x7b,0xef,0x63,0x4d,0x6b,0x6d,0x6b,0x6d,0x6b,0x6d,0x6b,0x6d,0x6b,0x6d,0x6b,0x6d,0x52,0xaa,0x29,0x66,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xde,0x7b,0xf0,0x29,0x65,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0xcf,0x79,0x7e,0xcf,0x76,0xcf,0x76,0xcf,0x76,0xcf,0x76,0xcf,0x76,0xcf,0x76,0xcf,0x76,0xcf,0xe7,0xdb,0xef,0x7f,0x64,0x1f,0x53,0xbf,0x53,0xbf,0x53,0xbf,0x53,0xbf,0x53,0xbf,0x53,0xbf,0x4b,0x9f,0xad,0xff,0xf7,0x9d,0x3a,0x08,0x31,0xa6,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0x97,0x12,0x5e,0x8b,0x5e,0x8c,0x5e,0x8c,0x5e,0x8c,0x5e,0x8c,0x5e,0x8c,0x5e,0x8c,0x56,0x6b,0xc7,0x97,0xce,0x9f,0x2a,0xde,0x33,0x1e,0x33,0x1e,0x33,0x1e,0x33,0x1e,0x33,0x1e,0x33,0x1e,0x2a,0xde,0x6c,0x5f,0xff,0xde,0x4a,0x8a,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0x97,0x13,0x5e,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x56,0x6b,0xc7,0x97,0xd6,0xbf,0x32,0xfe,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x32,0xfe,0x74,0x9f,0xff,0xde,0x4a,0x69,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0x97,0x13,0x5e,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x56,0x6b,0xc7,0x97,0xd6,0xbf,0x32,0xfe,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x32,0xfe,0x74,0x9f,0xff,0xde,0x4a,0x69,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0x97,0x13,0x5e,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x56,0x6b,0xc7,0x97,0xd6,0xbf,0x32,0xfe,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x32,0xfe,0x74,0x9f,0xff,0xde,0x4a,0x69,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x42,0x28,
|
||||
0x97,0x12,0x5e,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x56,0x6b,0xc7,0x97,0xd6,0xbf,0x32,0xfe,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x32,0xfe,0x74,0x9f,0xff,0xde,0x4a,0x69,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa6,0x3a,0x28,
|
||||
0xb7,0x56,0x5e,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x66,0x8c,0x56,0x6b,0xc7,0x97,0xd6,0xbf,0x32,0xfe,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x3b,0x3e,0x32,0xfe,0x74,0x9f,0xff,0xde,0x4a,0x69,0x29,0x86,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x31,0xa7,0x29,0x86,0x4a,0x69,
|
||||
0xef,0xdd,0x7e,0xcf,0x56,0x6b,0x5e,0x8c,0x5e,0x8c,0x5e,0x8c,0x5e,0x8c,0x5e,0x8c,0x56,0x6b,0xc7,0x97,0xce,0xbf,0x32,0xde,0x3b,0x1e,0x3b,0x1e,0x3b,0x1e,0x3b,0x1e,0x3b,0x1e,0x3b,0x1e,0x2a,0xde,0x6c,0x7f,0xff,0xde,0x42,0x49,0x29,0x86,0x31,0xa6,0x31,0xa6,0x31,0xa6,0x31,0xa6,0x29,0x86,0x21,0x45,0x9d,0x14,
|
||||
0xff,0xff,0xe7,0xdd,0x8e,0xf2,0x6e,0xae,0x6e,0xae,0x6e,0xae,0x6e,0xae,0x6e,0xad,0x6e,0xae,0xdf,0xdb,0xef,0x5f,0x53,0xdf,0x43,0x7f,0x4b,0x7f,0x4b,0x7f,0x4b,0x7f,0x4b,0x7f,0x4b,0x7f,0x43,0x5f,0x9d,0x7f,0xff,0xff,0x73,0xae,0x39,0xe7,0x42,0x28,0x42,0x28,0x42,0x28,0x3a,0x08,0x4a,0x69,0x9c,0xf3,0xff,0xff,
|
||||
|
||||
};
|
||||
|
||||
const lv_image_dsc_t img_render_lvgl_logo_rgb565_swapped = {
|
||||
.header.magic = LV_IMAGE_HEADER_MAGIC,
|
||||
.header.cf = LV_COLOR_FORMAT_RGB565_SWAPPED,
|
||||
.header.flags = 0,
|
||||
.header.w = 30,
|
||||
.header.h = 30,
|
||||
.header.stride = 60,
|
||||
.header.reserved_2 = 0,
|
||||
.data_size = sizeof(img_render_lvgl_logo_rgb565_swapped_map),
|
||||
.data = img_render_lvgl_logo_rgb565_swapped_map,
|
||||
.reserved = NULL,
|
||||
};
|
||||
|
||||
@@ -327,17 +327,19 @@ static lv_obj_t * image_obj_create(lv_obj_t * parent, int32_t col, int32_t row,
|
||||
return obj;
|
||||
|
||||
}
|
||||
#include <stdio.h>
|
||||
|
||||
static void image_core_cb(lv_obj_t * parent, bool recolor, uint32_t startAt)
|
||||
{
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_xrgb8888);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb888);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb565);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb565a8);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb565_swapped);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_argb8888);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_argb8888_premultiplied);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_l8);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_i1);
|
||||
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb565a8);
|
||||
|
||||
const void * srcs[] = {
|
||||
&img_render_lvgl_logo_argb8888,
|
||||
@@ -345,8 +347,10 @@ static void image_core_cb(lv_obj_t * parent, bool recolor, uint32_t startAt)
|
||||
&img_render_lvgl_logo_xrgb8888,
|
||||
&img_render_lvgl_logo_rgb888,
|
||||
&img_render_lvgl_logo_rgb565,
|
||||
&img_render_lvgl_logo_rgb565a8,
|
||||
&img_render_lvgl_logo_rgb565_swapped,
|
||||
&img_render_lvgl_logo_l8,
|
||||
NULL,
|
||||
&img_render_lvgl_logo_rgb565a8,
|
||||
&img_render_lvgl_logo_i1,
|
||||
};
|
||||
|
||||
@@ -356,8 +360,11 @@ static void image_core_cb(lv_obj_t * parent, bool recolor, uint32_t startAt)
|
||||
"XRGB\n8888",
|
||||
"RGB\n888",
|
||||
"RGB\n565",
|
||||
"RGB\n565A8",
|
||||
"RGB\n565\nSWAP",
|
||||
"L8",
|
||||
"", /*Make sure that RGB565A8 and I1 are on the same page.
|
||||
Both are disabled in VGLite as they are not supported*/
|
||||
"RGB\n565A8",
|
||||
"I1",
|
||||
};
|
||||
|
||||
@@ -428,6 +435,16 @@ static void image_recolored_2_cb(lv_obj_t * parent)
|
||||
image_core_cb(parent, true, 4);
|
||||
}
|
||||
|
||||
static void image_normal_3_cb(lv_obj_t * parent)
|
||||
{
|
||||
image_core_cb(parent, false, 8);
|
||||
}
|
||||
|
||||
static void image_recolored_3_cb(lv_obj_t * parent)
|
||||
{
|
||||
image_core_cb(parent, true, 8);
|
||||
}
|
||||
|
||||
static lv_obj_t * line_obj_create(lv_obj_t * parent, int32_t col, int32_t row, lv_point_precise_t p[])
|
||||
{
|
||||
lv_obj_t * obj = lv_line_create(parent);
|
||||
@@ -1105,6 +1122,8 @@ static scene_dsc_t scenes[] = {
|
||||
{.name = "image_recolor_1", .create_cb = image_recolored_1_cb},
|
||||
{.name = "image_normal_2", .create_cb = image_normal_2_cb},
|
||||
{.name = "image_recolor_2", .create_cb = image_recolored_2_cb},
|
||||
{.name = "image_normal_3", .create_cb = image_normal_3_cb},
|
||||
{.name = "image_recolor_3", .create_cb = image_recolored_3_cb},
|
||||
{.name = "line", .create_cb = line_cb},
|
||||
{.name = "arc_normal", .create_cb = arc_normal_cb},
|
||||
{.name = "arc_image", .create_cb = arc_image_cb},
|
||||
|
||||
@@ -37,6 +37,8 @@ typedef enum {
|
||||
LV_DEMO_RENDER_SCENE_IMAGE_RECOLOR_1,
|
||||
LV_DEMO_RENDER_SCENE_IMAGE_NORMAL_2,
|
||||
LV_DEMO_RENDER_SCENE_IMAGE_RECOLOR_2,
|
||||
LV_DEMO_RENDER_SCENE_IMAGE_NORMAL_3,
|
||||
LV_DEMO_RENDER_SCENE_IMAGE_RECOLOR_3,
|
||||
LV_DEMO_RENDER_SCENE_LINE,
|
||||
LV_DEMO_RENDER_SCENE_ARC_NORMAL,
|
||||
LV_DEMO_RENDER_SCENE_ARC_IMAGE,
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
* - bitmaps with transparency may use ARGB8888
|
||||
*/
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565 1
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 1
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565A8 1
|
||||
#define LV_DRAW_SW_SUPPORT_RGB888 1
|
||||
#define LV_DRAW_SW_SUPPORT_XRGB8888 1
|
||||
|
||||
@@ -26,6 +26,8 @@ def uint8_t(val) -> bytes:
|
||||
def uint16_t(val) -> bytes:
|
||||
return val.to_bytes(2, byteorder='little')
|
||||
|
||||
def swap_uint16_t(val) -> bytes:
|
||||
return val.to_bytes(2, byteorder='big')
|
||||
|
||||
def uint24_t(val) -> bytes:
|
||||
return val.to_bytes(3, byteorder='little')
|
||||
@@ -118,6 +120,7 @@ class ColorFormat(Enum):
|
||||
ARGB8888 = 0x10
|
||||
XRGB8888 = 0x11
|
||||
RGB565 = 0x12
|
||||
RGB565_SWAPPED = 0x1B
|
||||
ARGB8565 = 0x13
|
||||
RGB565A8 = 0x14
|
||||
RGB888 = 0x0F
|
||||
@@ -141,6 +144,7 @@ class ColorFormat(Enum):
|
||||
ColorFormat.ARGB8888: 32,
|
||||
ColorFormat.XRGB8888: 32,
|
||||
ColorFormat.RGB565: 16,
|
||||
ColorFormat.RGB565_SWAPPED: 16,
|
||||
ColorFormat.RGB565A8: 16, # 16bpp + a8 map
|
||||
ColorFormat.ARGB8565: 24,
|
||||
ColorFormat.RGB888: 24,
|
||||
@@ -189,6 +193,7 @@ class ColorFormat(Enum):
|
||||
return self in (ColorFormat.ARGB8888, ColorFormat.RGB888,
|
||||
ColorFormat.XRGB8888, ColorFormat.RGB565A8,
|
||||
ColorFormat.ARGB8565, ColorFormat.RGB565,
|
||||
ColorFormat.RGB565_SWAPPED,
|
||||
ColorFormat.ARGB8888_PREMULTIPLIED)
|
||||
|
||||
@property
|
||||
@@ -255,14 +260,23 @@ def unpack_colors(data: bytes, cf: ColorFormat, w) -> List:
|
||||
if len(ret) % w == 0:
|
||||
break
|
||||
elif bpp == 16:
|
||||
# This is RGB565
|
||||
pixels = [(data[2 * i + 1] << 8) | data[2 * i]
|
||||
for i in range(len(data) // 2)]
|
||||
|
||||
for p in pixels:
|
||||
ret.append(bit_extend((p >> 11) & 0x1f, 5)) # R
|
||||
ret.append(bit_extend((p >> 5) & 0x3f, 6)) # G
|
||||
ret.append(bit_extend((p >> 0) & 0x1f, 5)) # B
|
||||
if cf == ColorFormat.RGB565:
|
||||
# This is RGB565
|
||||
pixels = [(data[2 * i + 1] << 8) | data[2 * i]
|
||||
for i in range(len(data) // 2)]
|
||||
for p in pixels:
|
||||
ret.append(bit_extend((p >> 11) & 0x1f, 5)) # R
|
||||
ret.append(bit_extend((p >> 5) & 0x3f, 6)) # G
|
||||
ret.append(bit_extend((p >> 0) & 0x1f, 5)) # B
|
||||
elif cf == ColorFormat.RGB565_SWAPPED:
|
||||
# This is RGB565_SWAPPED
|
||||
pixels = [(data[2 * i] << 8) | data[2 * i + 1]
|
||||
for i in range(len(data) // 2)]
|
||||
for p in pixels:
|
||||
ret.append(bit_extend((p >> 11) & 0x1f, 5)) # R
|
||||
ret.append(bit_extend((p >> 5) & 0x3f, 6)) # G
|
||||
ret.append(bit_extend((p >> 0) & 0x1f, 5)) # B
|
||||
|
||||
elif bpp == 24:
|
||||
if cf == ColorFormat.RGB888:
|
||||
B = data[0::3]
|
||||
@@ -1030,6 +1044,14 @@ class LVGLImage:
|
||||
color |= (g >> 2) << 5
|
||||
color |= (b >> 3) << 0
|
||||
return uint16_t(color)
|
||||
elif cf == ColorFormat.RGB565_SWAPPED:
|
||||
|
||||
def pack(r, g, b, a):
|
||||
r, g, b, a = color_pre_multiply(r, g, b, a, self.background)
|
||||
color = (r >> 3) << 11
|
||||
color |= (g >> 2) << 5
|
||||
color |= (b >> 3) << 0
|
||||
return swap_uint16_t(color)
|
||||
|
||||
elif cf == ColorFormat.RGB565A8:
|
||||
|
||||
@@ -1063,7 +1085,7 @@ class LVGLImage:
|
||||
|
||||
if (
|
||||
self.rgb565_dither and
|
||||
cf in (ColorFormat.RGB565, ColorFormat.RGB565A8, ColorFormat.ARGB8565)
|
||||
cf in (ColorFormat.RGB565, ColorFormat.RGB565_SWAPPED, ColorFormat.RGB565A8, ColorFormat.ARGB8565)
|
||||
):
|
||||
treshold_id = ((y & 7) << 3) + (x & 7)
|
||||
|
||||
@@ -1366,7 +1388,7 @@ def main():
|
||||
default="I8",
|
||||
choices=[
|
||||
"L8", "I1", "I2", "I4", "I8", "A1", "A2", "A4", "A8", "ARGB8888",
|
||||
"XRGB8888", "RGB565", "RGB565A8", "ARGB8565", "RGB888", "AUTO",
|
||||
"XRGB8888", "RGB565", "RGB565_SWAPPED", "RGB565A8", "ARGB8565", "RGB888", "AUTO",
|
||||
"RAW", "RAW_ALPHA", "ARGB8888_PREMULTIPLIED"
|
||||
])
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
#include "lv_draw_sw_blend_to_rgb565.h"
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
#include "lv_draw_sw_blend_to_rgb565_swapped.h"
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
#include "lv_draw_sw_blend_to_argb8888.h"
|
||||
#endif
|
||||
@@ -177,6 +180,11 @@ static inline void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color(lv_color_format_
|
||||
lv_draw_sw_blend_color_to_rgb565(fill_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
lv_draw_sw_blend_color_to_rgb565_swapped(fill_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
lv_draw_sw_blend_color_to_argb8888(fill_dsc);
|
||||
@@ -227,6 +235,11 @@ static inline void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image(lv_color_format_
|
||||
lv_draw_sw_blend_image_to_rgb565(image_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
lv_draw_sw_blend_image_to_rgb565_swapped(image_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
lv_draw_sw_blend_image_to_argb8888(image_dsc);
|
||||
|
||||
@@ -647,6 +647,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
|
||||
for(x = 0; x < w; x++) {
|
||||
dest_buf_al88[x].lumi = lv_color16_luminance(src_buf_c16[x]);
|
||||
dest_buf_al88[x].alpha = 255;
|
||||
|
||||
@@ -64,6 +64,10 @@ typedef struct {
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_swapped_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size);
|
||||
@@ -87,6 +91,8 @@ static inline void /* LV_ATTRIBUTE_FAST_MEM */ blend_non_normal_pixel(lv_color32
|
||||
|
||||
static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * buf, uint32_t stride);
|
||||
|
||||
static inline lv_color16_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color16_from_u16(uint16_t raw);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
@@ -342,6 +348,11 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888(lv_draw_sw_blend_i
|
||||
rgb565_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
rgb565_swapped_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, 3);
|
||||
@@ -682,6 +693,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
lv_color_mix_alpha_cache_t cache;
|
||||
lv_color_mix_with_alpha_cache_init(&cache);
|
||||
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
|
||||
@@ -763,6 +775,116 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_swapped_image_blend(lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
int32_t h = dsc->dest_h;
|
||||
lv_opa_t opa = dsc->opa;
|
||||
lv_color32_t * dest_buf_c32 = dsc->dest_buf;
|
||||
int32_t dest_stride = dsc->dest_stride;
|
||||
const uint16_t * src_buf_u16 = dsc->src_buf;
|
||||
int32_t src_stride = dsc->src_stride;
|
||||
const lv_opa_t * mask_buf = dsc->mask_buf;
|
||||
int32_t mask_stride = dsc->mask_stride;
|
||||
|
||||
lv_color32_t color_argb;
|
||||
lv_color_mix_alpha_cache_t cache;
|
||||
lv_color_mix_with_alpha_cache_init(&cache);
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
|
||||
LV_UNUSED(color_argb);
|
||||
|
||||
uint16_t raw;
|
||||
lv_color16_t px;
|
||||
|
||||
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
|
||||
if(mask_buf == NULL) {
|
||||
lv_result_t accelerated;
|
||||
if(opa >= LV_OPA_MAX) {
|
||||
accelerated = LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(dsc);
|
||||
}
|
||||
else {
|
||||
accelerated = LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc);
|
||||
}
|
||||
if(LV_RESULT_INVALID == accelerated) {
|
||||
color_argb.alpha = opa;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
raw = lv_color_swap_16(src_buf_u16[x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
color_argb.red = (px.red * 2106) >> 8; /*To make it rounded*/
|
||||
color_argb.green = (px.green * 1037) >> 8;
|
||||
color_argb.blue = (px.blue * 2106) >> 8;
|
||||
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mask_buf && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
color_argb.alpha = mask_buf[x];
|
||||
raw = lv_color_swap_16(src_buf_u16[x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
color_argb.red = (px.red * 2106) >> 8; /*To make it rounded*/
|
||||
color_argb.green = (px.green * 1037) >> 8;
|
||||
color_argb.blue = (px.blue * 2106) >> 8;
|
||||
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
color_argb.alpha = LV_OPA_MIX2(mask_buf[x], opa);
|
||||
raw = lv_color_swap_16(src_buf_u16[x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
color_argb.red = (px.red * 2106) >> 8; /*To make it rounded*/
|
||||
color_argb.green = (px.green * 1037) >> 8;
|
||||
color_argb.blue = (px.blue * 2106) >> 8;
|
||||
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lv_color32_t src_argb;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
raw = lv_color_swap_16(src_buf_u16[x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
src_argb.red = (px.red * 2106) >> 8;
|
||||
src_argb.green = (px.green * 1037) >> 8;
|
||||
src_argb.blue = (px.blue * 2106) >> 8;
|
||||
if(mask_buf == NULL) src_argb.alpha = opa;
|
||||
else src_argb.alpha = LV_OPA_MIX2(mask_buf[x], opa);
|
||||
blend_non_normal_pixel(&dest_buf_c32[x], src_argb, dsc->blend_mode, &cache);
|
||||
}
|
||||
if(mask_buf) mask_buf += mask_stride;
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size)
|
||||
@@ -1228,6 +1350,15 @@ static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, ui
|
||||
return (void *)((uint8_t *)buf + stride);
|
||||
}
|
||||
|
||||
static inline lv_color16_t LV_ATTRIBUTE_FAST_MEM lv_color16_from_u16(uint16_t raw)
|
||||
{
|
||||
lv_color16_t c;
|
||||
c.red = (raw >> 11) & 0x1F;
|
||||
c.green = (raw >> 5) & 0x3F;
|
||||
c.blue = raw & 0x1F;
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif /* LV_DRAW_SW_SUPPORT_ARGB8888 */
|
||||
|
||||
#endif /* LV_USE_DRAW_SW */
|
||||
|
||||
@@ -50,6 +50,10 @@ static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(lv_draw_sw_blend_image_ds
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_swapped_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size);
|
||||
@@ -74,6 +78,8 @@ static inline uint8_t /* LV_ATTRIBUTE_FAST_MEM */ get_bit(const uint8_t * buf, i
|
||||
|
||||
static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * buf, uint32_t stride);
|
||||
|
||||
static inline lv_color16_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color16_from_u16(uint16_t raw);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
@@ -132,6 +138,22 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b
|
||||
#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_I1_MIX_MASK_OPA(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1
|
||||
#define LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_WITH_OPA
|
||||
#define LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_WITH_OPA(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_WITH_MASK
|
||||
#define LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_WITH_MASK(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_MIX_MASK_OPA
|
||||
#define LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_MIX_MASK_OPA(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_I1
|
||||
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_I1(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
@@ -314,6 +336,11 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_i1(lv_draw_sw_blend_image_d
|
||||
rgb565_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
rgb565_swapped_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, 3);
|
||||
@@ -828,9 +855,9 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
int32_t src_x;
|
||||
int32_t y;
|
||||
|
||||
|
||||
int32_t bit_ofs = dsc->relative_area.x1 % 8;
|
||||
|
||||
|
||||
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
|
||||
/*Special case*/
|
||||
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
|
||||
@@ -954,6 +981,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_I1(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
|
||||
for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) {
|
||||
uint8_t src = lv_color16_luminance(src_buf_c16[src_x]);
|
||||
if(src > I1_LUM_THRESHOLD) {
|
||||
@@ -1050,6 +1078,132 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_swapped_image_blend(lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
int32_t h = dsc->dest_h;
|
||||
lv_opa_t opa = dsc->opa;
|
||||
uint8_t * dest_buf_u8 = dsc->dest_buf;
|
||||
int32_t dest_stride = dsc->dest_stride;
|
||||
const uint16_t * src_buf_u16 = dsc->src_buf;
|
||||
int32_t src_stride = dsc->src_stride;
|
||||
const lv_opa_t * mask_buf = dsc->mask_buf;
|
||||
int32_t mask_stride = dsc->mask_stride;
|
||||
int32_t bit_ofs = dsc->relative_area.x1 % 8;
|
||||
|
||||
int32_t src_x;
|
||||
int32_t dest_x;
|
||||
int32_t y;
|
||||
lv_color16_t px;
|
||||
|
||||
|
||||
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
|
||||
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
|
||||
for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) {
|
||||
px = lv_color16_from_u16(lv_color_swap_16(src_buf_u16[src_x]));
|
||||
uint8_t src = lv_color16_luminance(px);
|
||||
if(src > I1_LUM_THRESHOLD) {
|
||||
set_bit(dest_buf_u8, dest_x + bit_ofs);
|
||||
}
|
||||
else {
|
||||
clear_bit(dest_buf_u8, dest_x + bit_ofs);
|
||||
}
|
||||
}
|
||||
dest_buf_u8 = drawbuf_next_row(dest_buf_u8, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mask_buf == NULL && opa < LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_WITH_OPA(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) {
|
||||
px = lv_color16_from_u16(lv_color_swap_16(src_buf_u16[src_x]));
|
||||
uint8_t src = lv_color16_luminance(px);
|
||||
uint8_t dest = get_bit(dest_buf_u8, dest_x + bit_ofs) * 255;
|
||||
lv_color_8_8_mix(src, &dest, opa);
|
||||
if(dest > I1_LUM_THRESHOLD) {
|
||||
set_bit(dest_buf_u8, dest_x + bit_ofs);
|
||||
}
|
||||
else {
|
||||
clear_bit(dest_buf_u8, dest_x + bit_ofs);
|
||||
}
|
||||
}
|
||||
dest_buf_u8 = drawbuf_next_row(dest_buf_u8, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mask_buf && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_WITH_MASK(dsc)) {
|
||||
uint32_t mask_x;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x++, src_x++) {
|
||||
px = lv_color16_from_u16(lv_color_swap_16(src_buf_u16[src_x]));
|
||||
uint8_t src = lv_color16_luminance(px);
|
||||
uint8_t dest = get_bit(dest_buf_u8, dest_x + bit_ofs) * 255;
|
||||
lv_color_8_8_mix(src, &dest, mask_buf[mask_x]);
|
||||
if(dest > I1_LUM_THRESHOLD) {
|
||||
set_bit(dest_buf_u8, dest_x + bit_ofs);
|
||||
}
|
||||
else {
|
||||
clear_bit(dest_buf_u8, dest_x + bit_ofs);
|
||||
}
|
||||
}
|
||||
dest_buf_u8 = drawbuf_next_row(dest_buf_u8, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mask_buf && opa < LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_SWAPPED_BLEND_NORMAL_TO_I1_MIX_MASK_OPA(dsc)) {
|
||||
uint32_t mask_x;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x++, src_x++) {
|
||||
px = lv_color16_from_u16(lv_color_swap_16(src_buf_u16[src_x]));
|
||||
uint8_t src = lv_color16_luminance(px);
|
||||
uint8_t dest = get_bit(dest_buf_u8, dest_x + bit_ofs) * 255;
|
||||
lv_color_8_8_mix(src, &dest, LV_OPA_MIX2(mask_buf[mask_x], opa));
|
||||
if(dest > I1_LUM_THRESHOLD) {
|
||||
set_bit(dest_buf_u8, dest_x + bit_ofs);
|
||||
}
|
||||
else {
|
||||
clear_bit(dest_buf_u8, dest_x + bit_ofs);
|
||||
}
|
||||
}
|
||||
dest_buf_u8 = drawbuf_next_row(dest_buf_u8, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lv_color32_t src_argb;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(src_x = 0, dest_x = 0; src_x < w; src_x++, dest_x++) {
|
||||
px = lv_color16_from_u16(lv_color_swap_16(src_buf_u16[src_x]));
|
||||
src_argb.red = (px.red * 2106) >> 8;
|
||||
src_argb.green = (px.green * 1037) >> 8;
|
||||
src_argb.blue = (px.blue * 2106) >> 8;
|
||||
if(mask_buf == NULL) src_argb.alpha = opa;
|
||||
else src_argb.alpha = LV_OPA_MIX2(mask_buf[src_x], opa);
|
||||
|
||||
blend_non_normal_pixel(dest_buf_u8, dest_x + bit_ofs, src_argb, dsc->blend_mode);
|
||||
}
|
||||
if(mask_buf) mask_buf += mask_stride;
|
||||
dest_buf_u8 = drawbuf_next_row(dest_buf_u8, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void LV_ATTRIBUTE_FAST_MEM blend_non_normal_pixel(uint8_t * dest_buf, int32_t dest_x, lv_color32_t src,
|
||||
lv_blend_mode_t mode)
|
||||
{
|
||||
@@ -1117,4 +1271,13 @@ static inline uint8_t LV_ATTRIBUTE_FAST_MEM get_bit(const uint8_t * buf, int32_t
|
||||
return (buf[bit_idx / 8] >> (7 - (bit_idx % 8))) & 1;
|
||||
}
|
||||
|
||||
static inline lv_color16_t LV_ATTRIBUTE_FAST_MEM lv_color16_from_u16(uint16_t raw)
|
||||
{
|
||||
lv_color16_t c;
|
||||
c.red = (raw >> 11) & 0x1F;
|
||||
c.green = (raw >> 5) & 0x3F;
|
||||
c.blue = raw & 0x1F;
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -54,6 +54,10 @@ static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(lv_draw_sw_blend_image_ds
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend_swapped(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size);
|
||||
@@ -70,6 +74,8 @@ static inline void /* LV_ATTRIBUTE_FAST_MEM */ blend_non_normal_pixel(uint8_t *
|
||||
|
||||
static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * buf, uint32_t stride);
|
||||
|
||||
static inline lv_color16_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color16_from_u16(uint16_t raw);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
@@ -288,6 +294,11 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_l8(lv_draw_sw_blend_image_d
|
||||
rgb565_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
rgb565_image_blend_swapped(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, 3);
|
||||
@@ -596,6 +607,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
const lv_opa_t * mask_buf = dsc->mask_buf;
|
||||
int32_t mask_stride = dsc->mask_stride;
|
||||
|
||||
|
||||
int32_t src_x;
|
||||
int32_t dest_x;
|
||||
int32_t y;
|
||||
@@ -668,6 +680,104 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend_swapped(lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
int32_t h = dsc->dest_h;
|
||||
lv_opa_t opa = dsc->opa;
|
||||
uint8_t * dest_buf_u8 = dsc->dest_buf;
|
||||
int32_t dest_stride = dsc->dest_stride;
|
||||
const uint16_t * src_buf_u16 = dsc->src_buf;
|
||||
int32_t src_stride = dsc->src_stride;
|
||||
const lv_opa_t * mask_buf = dsc->mask_buf;
|
||||
int32_t mask_stride = dsc->mask_stride;
|
||||
|
||||
int32_t src_x;
|
||||
int32_t dest_x;
|
||||
int32_t y;
|
||||
|
||||
uint16_t raw;
|
||||
lv_color16_t px;
|
||||
|
||||
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
|
||||
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) {
|
||||
raw = lv_color_swap_16(src_buf_u16[src_x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
dest_buf_u8[dest_x] = lv_color16_luminance(px);
|
||||
}
|
||||
dest_buf_u8 += dest_stride;
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mask_buf == NULL && opa < LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_WITH_OPA(dsc, dest_px_size)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) {
|
||||
raw = lv_color_swap_16(src_buf_u16[src_x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
lv_color_8_8_mix(lv_color16_luminance(px), &dest_buf_u8[dest_x], opa);
|
||||
}
|
||||
dest_buf_u8 += dest_stride;
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mask_buf && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_WITH_MASK(dsc, dest_px_size)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) {
|
||||
raw = lv_color_swap_16(src_buf_u16[src_x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
lv_color_8_8_mix(lv_color16_luminance(px), &dest_buf_u8[dest_x], mask_buf[src_x]);
|
||||
}
|
||||
dest_buf_u8 += dest_stride;
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(dsc, dest_px_size)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) {
|
||||
raw = lv_color_swap_16(src_buf_u16[src_x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
lv_color_8_8_mix(lv_color16_luminance(px), &dest_buf_u8[dest_x], LV_OPA_MIX2(opa, mask_buf[src_x]));
|
||||
}
|
||||
dest_buf_u8 += dest_stride;
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lv_color32_t src_argb;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(src_x = 0, dest_x = 0; src_x < w; src_x++, dest_x++) {
|
||||
raw = lv_color_swap_16(src_buf_u16[src_x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
src_argb.red = (px.red * 2106) >> 8;
|
||||
src_argb.green = (px.green * 1037) >> 8;
|
||||
src_argb.blue = (px.blue * 2106) >> 8;
|
||||
if(mask_buf == NULL) src_argb.alpha = opa;
|
||||
else src_argb.alpha = LV_OPA_MIX2(mask_buf[src_x], opa);
|
||||
blend_non_normal_pixel(&dest_buf_u8[dest_x], src_argb, dsc->blend_mode);
|
||||
}
|
||||
if(mask_buf) mask_buf += mask_stride;
|
||||
dest_buf_u8 += dest_stride;
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
@@ -748,6 +858,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
if(mask_buf == NULL) src_argb.alpha = opa;
|
||||
else src_argb.alpha = LV_OPA_MIX2(mask_buf[dest_x], opa);
|
||||
|
||||
|
||||
blend_non_normal_pixel(&dest_buf_l8[dest_x], src_argb, dsc->blend_mode);
|
||||
}
|
||||
if(mask_buf) mask_buf += mask_stride;
|
||||
@@ -856,7 +967,6 @@ static inline void LV_ATTRIBUTE_FAST_MEM lv_color_8_8_mix(const uint8_t src, uin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_I1
|
||||
|
||||
static inline uint8_t LV_ATTRIBUTE_FAST_MEM get_bit(const uint8_t * buf, int32_t bit_idx)
|
||||
@@ -895,6 +1005,15 @@ static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, ui
|
||||
return (void *)((uint8_t *)buf + stride);
|
||||
}
|
||||
|
||||
static inline lv_color16_t LV_ATTRIBUTE_FAST_MEM lv_color16_from_u16(uint16_t raw)
|
||||
{
|
||||
lv_color16_t c;
|
||||
c.red = (raw >> 11) & 0x1F;
|
||||
c.green = (raw >> 5) & 0x3F;
|
||||
c.blue = raw & 0x1F;
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -54,6 +54,10 @@
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_swapped_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size);
|
||||
@@ -75,6 +79,8 @@ static inline uint16_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color_24_16_mix(const uint
|
||||
|
||||
static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * buf, uint32_t stride);
|
||||
|
||||
static inline lv_color16_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color16_from_u16(uint16_t raw);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
@@ -382,6 +388,11 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb565(lv_draw_sw_blend_ima
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rgb565_image_blend(dsc);
|
||||
break;
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
rgb565_swapped_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, 3);
|
||||
@@ -902,6 +913,128 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_swapped_image_blend(lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
int32_t h = dsc->dest_h;
|
||||
lv_opa_t opa = dsc->opa;
|
||||
uint16_t * dest_buf_u16 = dsc->dest_buf;
|
||||
int32_t dest_stride = dsc->dest_stride;
|
||||
const uint16_t * src_buf_u16 = dsc->src_buf;
|
||||
int32_t src_stride = dsc->src_stride;
|
||||
const lv_opa_t * mask_buf = dsc->mask_buf;
|
||||
int32_t mask_stride = dsc->mask_stride;
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
|
||||
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
|
||||
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc)) {
|
||||
uint32_t line_in_bytes = w * 2;
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(dest_buf_u16, src_buf_u16, line_in_bytes);
|
||||
lv_draw_sw_rgb565_swap((uint8_t *) dest_buf_u16, w);
|
||||
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mask_buf == NULL && opa < LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
dest_buf_u16[x] = lv_color_16_16_mix(lv_color_swap_16(src_buf_u16[x]), dest_buf_u16[x], opa);
|
||||
}
|
||||
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mask_buf && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
dest_buf_u16[x] = lv_color_16_16_mix(lv_color_swap_16(src_buf_u16[x]), dest_buf_u16[x], mask_buf[x]);
|
||||
}
|
||||
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
dest_buf_u16[x] = lv_color_16_16_mix(lv_color_swap_16(src_buf_u16[x]), dest_buf_u16[x], LV_OPA_MIX2(mask_buf[x], opa));
|
||||
}
|
||||
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint16_t res = 0;
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_color16_t * dest_buf_c16 = (lv_color16_t *) dest_buf_u16;
|
||||
|
||||
for(x = 0; x < w; x++) {
|
||||
uint16_t raw;
|
||||
lv_color16_t px;
|
||||
raw = lv_color_swap_16(src_buf_u16[x]); /* swap byte order */
|
||||
px = lv_color16_from_u16(raw);
|
||||
|
||||
switch(dsc->blend_mode) {
|
||||
case LV_BLEND_MODE_ADDITIVE:
|
||||
if(src_buf_u16[x] == 0x0000) continue; /*Do not add pure black*/
|
||||
res = (LV_MIN(dest_buf_c16[x].red + px.red, 31)) << 11;
|
||||
res += (LV_MIN(dest_buf_c16[x].green + px.green, 63)) << 5;
|
||||
res += LV_MIN(dest_buf_c16[x].blue + px.blue, 31);
|
||||
break;
|
||||
case LV_BLEND_MODE_SUBTRACTIVE:
|
||||
if(src_buf_u16[x] == 0x0000) continue; /*Do not subtract pure black*/
|
||||
res = (LV_MAX(dest_buf_c16[x].red - px.red, 0)) << 11;
|
||||
res += (LV_MAX(dest_buf_c16[x].green - px.green, 0)) << 5;
|
||||
res += LV_MAX(dest_buf_c16[x].blue - px.blue, 0);
|
||||
break;
|
||||
case LV_BLEND_MODE_MULTIPLY:
|
||||
if(src_buf_u16[x] == 0xffff) continue; /*Do not multiply with pure white (considered as 1)*/
|
||||
res = ((dest_buf_c16[x].red * px.red) >> 5) << 11;
|
||||
res += ((dest_buf_c16[x].green * px.green) >> 6) << 5;
|
||||
res += (dest_buf_c16[x].blue * px.blue) >> 5;
|
||||
break;
|
||||
case LV_BLEND_MODE_DIFFERENCE:
|
||||
res = (LV_ABS(dest_buf_c16[x].red - px.red)) << 11;
|
||||
res += (LV_ABS(dest_buf_c16[x].green - px.green)) << 5;
|
||||
res += LV_ABS(dest_buf_c16[x].blue - px.blue);
|
||||
break;
|
||||
default:
|
||||
LV_LOG_WARN("Not supported blend mode: %d", dsc->blend_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mask_buf == NULL) {
|
||||
dest_buf_u16[x] = lv_color_16_16_mix(res, dest_buf_u16[x], opa);
|
||||
}
|
||||
else {
|
||||
if(opa >= LV_OPA_MAX) dest_buf_u16[x] = lv_color_16_16_mix(res, dest_buf_u16[x], mask_buf[x]);
|
||||
else dest_buf_u16[x] = lv_color_16_16_mix(res, dest_buf_u16[x], LV_OPA_MIX2(mask_buf[x], opa));
|
||||
}
|
||||
}
|
||||
|
||||
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
|
||||
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
|
||||
if(mask_buf) mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size)
|
||||
@@ -1364,6 +1497,15 @@ static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, ui
|
||||
return (void *)((uint8_t *)buf + stride);
|
||||
}
|
||||
|
||||
static inline lv_color16_t LV_ATTRIBUTE_FAST_MEM lv_color16_from_u16(uint16_t raw)
|
||||
{
|
||||
lv_color16_t c;
|
||||
c.red = (raw >> 11) & 0x1F;
|
||||
c.green = (raw >> 5) & 0x3F;
|
||||
c.blue = raw & 0x1F;
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif /*LV_DRAW_SW_SUPPORT_RGB565*/
|
||||
|
||||
#endif /*LV_USE_DRAW_SW*/
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @file lv_draw_sw_blend_to_rgb565_swapped.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SW_BLEND_TO_RGB565_SWAPPED_H
|
||||
#define LV_DRAW_SW_BLEND_TO_RGB565_SWAPPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_draw_sw.h"
|
||||
#if LV_USE_DRAW_SW
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_rgb565_swapped(lv_draw_sw_blend_fill_dsc_t * dsc);
|
||||
|
||||
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_rgb565_swapped(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_SW*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SW_BLEND_TO_RGB565_H*/
|
||||
@@ -43,6 +43,10 @@
|
||||
#define LV_DRAW_SW_RGB565_RECOLOR(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB565_SWAPPED_RECOLOR
|
||||
#define LV_DRAW_SW_RGB565_SWAPPED_RECOLOR(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB888_RECOLOR
|
||||
#define LV_DRAW_SW_RGB888_RECOLOR(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
@@ -59,6 +63,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
|
||||
static void img_draw_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
|
||||
const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup,
|
||||
const lv_area_t * img_coords, const lv_area_t * clipped_img_area);
|
||||
@@ -78,7 +83,6 @@ static void transform_and_recolor(lv_draw_task_t * t, const lv_draw_image_dsc_t
|
||||
const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup,
|
||||
const lv_area_t * img_coords, const lv_area_t * clipped_img_area);
|
||||
|
||||
|
||||
static void recolor(lv_area_t relative_area, uint8_t * src_buf, uint8_t * dest_buf, int32_t src_stride,
|
||||
lv_color_format_t cf, const lv_draw_image_dsc_t * draw_dsc);
|
||||
|
||||
@@ -311,11 +315,11 @@ static void radius_only(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc
|
||||
uint32_t img_stride = decoded->header.stride;
|
||||
lv_color_format_t cf = decoded->header.cf;
|
||||
lv_color_format_t cf_ori = cf;
|
||||
|
||||
if(cf == LV_COLOR_FORMAT_RGB565A8) {
|
||||
cf = LV_COLOR_FORMAT_RGB565;
|
||||
}
|
||||
|
||||
|
||||
lv_draw_sw_blend_dsc_t blend_dsc;
|
||||
lv_memzero(&blend_dsc, sizeof(lv_draw_sw_blend_dsc_t));
|
||||
blend_dsc.opa = draw_dsc->opa;
|
||||
@@ -438,11 +442,11 @@ static void recolor_only(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_ds
|
||||
if(blend_area.y2 > y_last) {
|
||||
blend_area.y2 = y_last;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
lv_free(tmp_buf);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void transform_and_recolor(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
|
||||
@@ -474,7 +478,8 @@ static void transform_and_recolor(lv_draw_task_t * t, const lv_draw_image_dsc_t
|
||||
|
||||
lv_color_format_t cf_final = cf;
|
||||
if(cf_final == LV_COLOR_FORMAT_RGB888 || cf_final == LV_COLOR_FORMAT_XRGB8888) cf_final = LV_COLOR_FORMAT_ARGB8888;
|
||||
else if(cf_final == LV_COLOR_FORMAT_RGB565) cf_final = LV_COLOR_FORMAT_RGB565A8;
|
||||
else if(cf_final == LV_COLOR_FORMAT_RGB565 ||
|
||||
cf_final == LV_COLOR_FORMAT_RGB565_SWAPPED) cf_final = LV_COLOR_FORMAT_RGB565A8;
|
||||
else if(cf_final == LV_COLOR_FORMAT_L8) cf_final = LV_COLOR_FORMAT_AL88;
|
||||
|
||||
uint8_t * transformed_buf;
|
||||
@@ -602,6 +607,46 @@ static void recolor(lv_area_t relative_area, uint8_t * src_buf, uint8_t * dest_b
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(cf == LV_COLOR_FORMAT_RGB565_SWAPPED) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_SWAPPED_RECOLOR(dest_buf, blend_area, color, mix)) {
|
||||
const uint8_t * src_buf_tmp = src_buf + src_stride * relative_area.y1 + relative_area.x1 * 2;
|
||||
int32_t img_stride_px = src_stride / 2;
|
||||
|
||||
uint16_t * buf16_src = (uint16_t *)src_buf_tmp;
|
||||
uint16_t * buf16_dest = (uint16_t *)dest_buf;
|
||||
uint16_t color16 = lv_color_to_u16(color);
|
||||
if(mix >= LV_OPA_MAX) {
|
||||
int32_t y;
|
||||
for(y = 0; y < h; y++) {
|
||||
int32_t x;
|
||||
for(x = 0; x < w; x++) {
|
||||
*buf16_dest = color16;
|
||||
buf16_dest++;
|
||||
}
|
||||
buf16_src += img_stride_px;
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint16_t c_mult[3];
|
||||
c_mult[0] = (color.blue >> 3) * mix;
|
||||
c_mult[1] = (color.green >> 2) * mix;
|
||||
c_mult[2] = (color.red >> 3) * mix;
|
||||
|
||||
int32_t y;
|
||||
for(y = 0; y < h; y++) {
|
||||
int32_t x;
|
||||
for(x = 0; x < w; x++) {
|
||||
*buf16_dest = lv_color_swap_16((((c_mult[2] + ((lv_color_swap_16(buf16_src[x]) >> 11) & 0x1F) * mix_inv) << 3) & 0xF800)
|
||||
+
|
||||
(((c_mult[1] + ((lv_color_swap_16(buf16_src[x]) >> 5) & 0x3F) * mix_inv) >> 3) & 0x07E0) +
|
||||
((c_mult[0] + (lv_color_swap_16(buf16_src[x]) & 0x1F) * mix_inv) >> 8));
|
||||
buf16_dest++;
|
||||
}
|
||||
buf16_src += img_stride_px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(cf == LV_COLOR_FORMAT_RGB888 || cf == LV_COLOR_FORMAT_XRGB8888 || cf == LV_COLOR_FORMAT_ARGB8888) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_RECOLOR(dest_buf, blend_area, color, mix, cf_final)) {
|
||||
uint32_t px_size = lv_color_format_get_size(cf);
|
||||
|
||||
@@ -75,6 +75,12 @@ static void transform_rgb565a8(const uint8_t * src, int32_t src_w, int32_t src_h
|
||||
int32_t x_end, uint16_t * cbuf, uint8_t * abuf, bool src_has_a8, bool aa);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
static void transform_rgb565a8_swapped(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint16_t * cbuf, uint8_t * abuf, bool src_has_a8, bool aa);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_A8
|
||||
static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
@@ -146,7 +152,7 @@ void lv_draw_sw_transform(const lv_area_t * dest_area, const void * src_buf,
|
||||
}
|
||||
|
||||
uint8_t * alpha_buf;
|
||||
if(src_cf == LV_COLOR_FORMAT_RGB565 || src_cf == LV_COLOR_FORMAT_RGB565A8) {
|
||||
if(src_cf == LV_COLOR_FORMAT_RGB565 || src_cf == LV_COLOR_FORMAT_RGB565_SWAPPED || src_cf == LV_COLOR_FORMAT_RGB565A8) {
|
||||
alpha_buf = dest_buf;
|
||||
alpha_buf += dest_stride * dest_h;
|
||||
}
|
||||
@@ -268,6 +274,12 @@ void lv_draw_sw_transform(const lv_area_t * dest_area, const void * src_buf,
|
||||
alpha_buf, false, aa);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
transform_rgb565a8_swapped(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w,
|
||||
dest_buf, alpha_buf, false, aa);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
case LV_COLOR_FORMAT_RGB565A8:
|
||||
transform_rgb565a8(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w,
|
||||
@@ -738,6 +750,122 @@ static void transform_rgb565a8(const uint8_t * src, int32_t src_w, int32_t src_h
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
|
||||
static void transform_rgb565a8_swapped(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint16_t * cbuf, uint8_t * abuf, bool src_has_a8, bool aa)
|
||||
{
|
||||
int32_t xs_ups_start = xs_ups;
|
||||
int32_t ys_ups_start = ys_ups;
|
||||
|
||||
const lv_opa_t * src_alpha = src + src_stride * src_h;
|
||||
|
||||
/*Must be signed type, because we would use negative array index calculated from stride*/
|
||||
int32_t alpha_stride = src_stride / 2; /*alpha map stride is always half of RGB map stride*/
|
||||
|
||||
int32_t x;
|
||||
for(x = 0; x < x_end; x++) {
|
||||
xs_ups = xs_ups_start + ((xs_step * x) >> 8);
|
||||
ys_ups = ys_ups_start + ((ys_step * x) >> 8);
|
||||
|
||||
int32_t xs_int = xs_ups >> 8;
|
||||
int32_t ys_int = ys_ups >> 8;
|
||||
|
||||
/*Fully out of the image*/
|
||||
if(xs_int < 0 || xs_int >= src_w || ys_int < 0 || ys_int >= src_h) {
|
||||
abuf[x] = 0x00;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*Get the direction the hor and ver neighbor
|
||||
*`fract` will be in range of 0x00..0xFF and `next` (+/-1) indicates the direction*/
|
||||
int32_t xs_fract = xs_ups & 0xFF;
|
||||
int32_t ys_fract = ys_ups & 0xFF;
|
||||
|
||||
int32_t x_next;
|
||||
int32_t y_next;
|
||||
if(xs_fract < 0x80) {
|
||||
x_next = -1;
|
||||
xs_fract = (0x7F - xs_fract) * 2;
|
||||
}
|
||||
else {
|
||||
x_next = 1;
|
||||
xs_fract = (xs_fract - 0x80) * 2;
|
||||
}
|
||||
if(ys_fract < 0x80) {
|
||||
y_next = -1;
|
||||
ys_fract = (0x7F - ys_fract) * 2;
|
||||
}
|
||||
else {
|
||||
y_next = 1;
|
||||
ys_fract = (ys_fract - 0x80) * 2;
|
||||
}
|
||||
|
||||
const uint16_t * src_tmp_u16 = (const uint16_t *)(src + (ys_int * src_stride) + xs_int * 2);
|
||||
cbuf[x] = lv_color_swap_16(src_tmp_u16[0]); /* swap the src pixels */
|
||||
|
||||
if(aa &&
|
||||
xs_int + x_next >= 0 &&
|
||||
xs_int + x_next <= src_w - 1 &&
|
||||
ys_int + y_next >= 0 &&
|
||||
ys_int + y_next <= src_h - 1) {
|
||||
|
||||
/* swap the src pixels */
|
||||
uint16_t px_hor = lv_color_swap_16(src_tmp_u16[x_next]);
|
||||
uint16_t px_ver = lv_color_swap_16(*(const uint16_t *)((uint8_t *)src_tmp_u16 + (y_next * src_stride)));
|
||||
|
||||
if(src_has_a8) {
|
||||
const lv_opa_t * src_alpha_tmp = src_alpha;
|
||||
src_alpha_tmp += (ys_int * alpha_stride) + xs_int;
|
||||
abuf[x] = src_alpha_tmp[0];
|
||||
|
||||
lv_opa_t a_hor = src_alpha_tmp[x_next];
|
||||
lv_opa_t a_ver = src_alpha_tmp[y_next * alpha_stride];
|
||||
|
||||
if(a_ver != abuf[x]) a_ver = ((a_ver * ys_fract) + (abuf[x] * (0x100 - ys_fract))) >> 8;
|
||||
if(a_hor != abuf[x]) a_hor = ((a_hor * xs_fract) + (abuf[x] * (0x100 - xs_fract))) >> 8;
|
||||
abuf[x] = (a_ver + a_hor) >> 1;
|
||||
|
||||
if(abuf[x] == 0x00) continue;
|
||||
}
|
||||
else {
|
||||
abuf[x] = 0xff;
|
||||
}
|
||||
|
||||
if(cbuf[x] != px_ver || cbuf[x] != px_hor) {
|
||||
uint16_t v = lv_color_16_16_mix(px_ver, cbuf[x], ys_fract);
|
||||
uint16_t h = lv_color_16_16_mix(px_hor, cbuf[x], xs_fract);
|
||||
cbuf[x] = lv_color_16_16_mix(h, v, LV_OPA_50);
|
||||
}
|
||||
}
|
||||
/*Partially out of the image*/
|
||||
else {
|
||||
lv_opa_t a;
|
||||
if(src_has_a8) {
|
||||
const lv_opa_t * src_alpha_tmp = src_alpha;
|
||||
src_alpha_tmp += (ys_int * alpha_stride) + xs_int;
|
||||
a = src_alpha_tmp[0];
|
||||
}
|
||||
else {
|
||||
a = 0xff;
|
||||
}
|
||||
|
||||
if((xs_int == 0 && x_next < 0) || (xs_int == src_w - 1 && x_next > 0)) {
|
||||
abuf[x] = (a * (0xFF - xs_fract)) >> 8;
|
||||
}
|
||||
else if((ys_int == 0 && y_next < 0) || (ys_int == src_h - 1 && y_next > 0)) {
|
||||
abuf[x] = (a * (0xFF - ys_fract)) >> 8;
|
||||
}
|
||||
else {
|
||||
abuf[x] = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_A8
|
||||
|
||||
static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
|
||||
@@ -150,9 +150,17 @@ void lv_draw_sw_rgb565_swap(void * buf, uint32_t buf_size_px)
|
||||
{
|
||||
if(LV_DRAW_SW_RGB565_SWAP(buf, buf_size_px) == LV_RESULT_OK) return;
|
||||
|
||||
uint32_t u32_cnt = buf_size_px / 2;
|
||||
uint16_t * buf16 = buf;
|
||||
uint32_t * buf32 = buf;
|
||||
|
||||
/*2 pixels will be processed later, so handle 1 pixel alignment*/
|
||||
if((lv_uintptr_t)buf16 & 0x2) {
|
||||
buf16[0] = ((buf16[0] & 0xff00) >> 8) | ((buf16[0] & 0x00ff) << 8);
|
||||
buf16++;
|
||||
buf_size_px--;
|
||||
}
|
||||
|
||||
uint32_t * buf32 = (uint32_t *)buf16;
|
||||
uint32_t u32_cnt = buf_size_px / 2;
|
||||
|
||||
while(u32_cnt >= 8) {
|
||||
buf32[0] = ((buf32[0] & 0xff00ff00) >> 8) | ((buf32[0] & 0x00ff00ff) << 8);
|
||||
@@ -173,6 +181,7 @@ void lv_draw_sw_rgb565_swap(void * buf, uint32_t buf_size_px)
|
||||
u32_cnt--;
|
||||
}
|
||||
|
||||
/*Process the last pixel if needed*/
|
||||
if(buf_size_px & 0x1) {
|
||||
uint32_t e = buf_size_px - 1;
|
||||
buf16[e] = ((buf16[e] & 0xff00) >> 8) | ((buf16[e] & 0x00ff) << 8);
|
||||
|
||||
@@ -570,6 +570,9 @@ vg_lite_buffer_format_t lv_vg_lite_vg_fmt(lv_color_format_t cf)
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
return VG_LITE_BGR565;
|
||||
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
return VG_LITE_RGB565;
|
||||
|
||||
case LV_COLOR_FORMAT_ARGB8565:
|
||||
return VG_LITE_BGRA5658;
|
||||
|
||||
|
||||
@@ -235,6 +235,12 @@ static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_m
|
||||
uint32_t * argb_px_map = NULL;
|
||||
|
||||
if(sdl_render_mode() == LV_DISPLAY_RENDER_MODE_PARTIAL) {
|
||||
|
||||
if(cf == LV_COLOR_FORMAT_RGB565_SWAPPED) {
|
||||
uint32_t width = lv_area_get_width(area);
|
||||
uint32_t height = lv_area_get_height(area);
|
||||
lv_draw_sw_rgb565_swap(px_map, width * height);
|
||||
}
|
||||
/*Update values in a special OLED I1 --> ARGB8888 case
|
||||
We render everything in I1, but display it in ARGB8888*/
|
||||
if(cf == LV_COLOR_FORMAT_I1) {
|
||||
|
||||
@@ -240,6 +240,7 @@ lv_result_t lv_bin_decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
|
||||
|| cf == LV_COLOR_FORMAT_XRGB8888 \
|
||||
|| cf == LV_COLOR_FORMAT_RGB888 \
|
||||
|| cf == LV_COLOR_FORMAT_RGB565 \
|
||||
|| cf == LV_COLOR_FORMAT_RGB565_SWAPPED \
|
||||
|| cf == LV_COLOR_FORMAT_RGB565A8 \
|
||||
|| cf == LV_COLOR_FORMAT_ARGB8565) {
|
||||
res = decode_rgb(decoder, dsc);
|
||||
@@ -399,6 +400,7 @@ lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod
|
||||
|| cf == LV_COLOR_FORMAT_XRGB8888 \
|
||||
|| cf == LV_COLOR_FORMAT_RGB888 \
|
||||
|| cf == LV_COLOR_FORMAT_RGB565 \
|
||||
|| cf == LV_COLOR_FORMAT_RGB565_SWAPPED \
|
||||
|| cf == LV_COLOR_FORMAT_ARGB8565 \
|
||||
|| cf == LV_COLOR_FORMAT_RGB565A8;
|
||||
if(!supported) {
|
||||
@@ -484,7 +486,7 @@ lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod
|
||||
}
|
||||
|
||||
if(cf == LV_COLOR_FORMAT_ARGB8888 || cf == LV_COLOR_FORMAT_XRGB8888 || cf == LV_COLOR_FORMAT_RGB888
|
||||
|| cf == LV_COLOR_FORMAT_RGB565 || cf == LV_COLOR_FORMAT_ARGB8565) {
|
||||
|| cf == LV_COLOR_FORMAT_RGB565 || cf == LV_COLOR_FORMAT_RGB565_SWAPPED || cf == LV_COLOR_FORMAT_ARGB8565) {
|
||||
uint32_t len = (w_px * bpp) / 8;
|
||||
offset += decoded_area->y1 * dsc->header.stride;
|
||||
offset += decoded_area->x1 * bpp / 8; /*Move to x1*/
|
||||
|
||||
@@ -421,6 +421,17 @@
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
#ifdef LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED CONFIG_LV_DRAW_SW_SUPPORT_RGB565_SWAPPED
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
#ifdef LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
|
||||
@@ -67,6 +67,7 @@ uint8_t lv_color_format_get_bpp(lv_color_format_t cf)
|
||||
return 12;
|
||||
case LV_COLOR_FORMAT_RGB565A8:
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
case LV_COLOR_FORMAT_RGB565_SWAPPED:
|
||||
case LV_COLOR_FORMAT_YUY2:
|
||||
case LV_COLOR_FORMAT_AL88:
|
||||
case LV_COLOR_FORMAT_ARGB1555:
|
||||
@@ -394,6 +395,7 @@ uint8_t lv_color32_luminance(lv_color32_t c)
|
||||
return (uint8_t)((uint16_t)(77u * c.red + 151u * c.green + 28u * c.blue) >> 8);
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -81,6 +81,7 @@ enum {
|
||||
(cf) == LV_COLOR_FORMAT_NEMA_TSC12A ? 12 : \
|
||||
(cf) == LV_COLOR_FORMAT_AL88 ? 16 : \
|
||||
(cf) == LV_COLOR_FORMAT_RGB565 ? 16 : \
|
||||
(cf) == LV_COLOR_FORMAT_RGB565_SWAPPED ? 16 : \
|
||||
(cf) == LV_COLOR_FORMAT_RGB565A8 ? 16 : \
|
||||
(cf) == LV_COLOR_FORMAT_YUY2 ? 16 : \
|
||||
(cf) == LV_COLOR_FORMAT_ARGB1555 ? 16 : \
|
||||
@@ -154,6 +155,7 @@ typedef enum {
|
||||
LV_COLOR_FORMAT_ARGB8565 = 0x13, /**< Not supported by sw renderer yet. */
|
||||
LV_COLOR_FORMAT_RGB565A8 = 0x14, /**< Color array followed by Alpha array*/
|
||||
LV_COLOR_FORMAT_AL88 = 0x15, /**< L8 with alpha >*/
|
||||
LV_COLOR_FORMAT_RGB565_SWAPPED = 0x1B,
|
||||
|
||||
/*3 byte (+alpha) formats*/
|
||||
LV_COLOR_FORMAT_RGB888 = 0x0F,
|
||||
@@ -438,6 +440,17 @@ uint8_t lv_color24_luminance(const uint8_t * c);
|
||||
*/
|
||||
uint8_t lv_color32_luminance(lv_color32_t c);
|
||||
|
||||
|
||||
/**
|
||||
* Swap the endianness of an rgb565 color
|
||||
* @param c a color
|
||||
* @return the swapped color
|
||||
*/
|
||||
static inline uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_swap_16(uint16_t c)
|
||||
{
|
||||
return (c >> 8) | (c << 8);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -189,7 +189,10 @@ static void buf_to_xrgb8888(const lv_draw_buf_t * draw_buf, uint8_t * buf_out)
|
||||
lv_color_format_t cf_in = draw_buf->header.cf;
|
||||
const uint8_t * buf_in = draw_buf->data;
|
||||
|
||||
if(cf_in == LV_COLOR_FORMAT_RGB565) {
|
||||
if(cf_in == LV_COLOR_FORMAT_RGB565 || cf_in == LV_COLOR_FORMAT_RGB565_SWAPPED) {
|
||||
if(cf_in == LV_COLOR_FORMAT_RGB565_SWAPPED) {
|
||||
lv_draw_sw_rgb565_swap(draw_buf->data, draw_buf->header.w * draw_buf->header.h);
|
||||
}
|
||||
uint32_t y;
|
||||
for(y = 0; y < draw_buf->header.h; y++) {
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 4.8 KiB |