diff --git a/src/lgfx/v1/LGFXBase.cpp b/src/lgfx/v1/LGFXBase.cpp index a415cef7..2f132e07 100644 --- a/src/lgfx/v1/LGFXBase.cpp +++ b/src/lgfx/v1/LGFXBase.cpp @@ -1510,15 +1510,15 @@ namespace lgfx else if (pc_post.dst_bits > 16) { if (dst_depth == rgb888_3Byte) { - pc_post.fp_copy = pixelcopy_t::blend_rgb_fast; + pc_post.fp_copy = pixelcopy_t::blend_rgb_fast; } else { - pc_post.fp_copy = pixelcopy_t::blend_rgb_fast; + pc_post.fp_copy = pixelcopy_t::blend_rgb_fast; } } else { if (dst_depth == rgb565_2Byte) { - pc_post.fp_copy = pixelcopy_t::blend_rgb_fast; + pc_post.fp_copy = pixelcopy_t::blend_rgb_fast; } else { // src_depth == rgb332_1Byte: - pc_post.fp_copy = pixelcopy_t::blend_rgb_fast; + pc_post.fp_copy = pixelcopy_t::blend_rgb_fast; } } push_image_affine_aa(matrix, pc, &pc_post); diff --git a/src/lgfx/v1/LGFXBase.hpp b/src/lgfx/v1/LGFXBase.hpp index 979fec89..ec96117e 100644 --- a/src/lgfx/v1/LGFXBase.hpp +++ b/src/lgfx/v1/LGFXBase.hpp @@ -564,6 +564,34 @@ namespace lgfx LGFX_INLINE_T void pushGrayscaleImageRotateZoom(float dst_x, float dst_y, float src_x, float src_y, float angle, float zoom_x, float zoom_y, int32_t w, int32_t h, const uint8_t* image, color_depth_t depth, const T& forecolor, const T& backcolor) { push_grayimage_rotate_zoom(dst_x, dst_y, src_x, src_y, angle, zoom_x, zoom_y, w, h, image, depth, convert_to_rgb888(forecolor), convert_to_rgb888(backcolor)); } LGFX_INLINE_T void pushGrayscaleImageAffine(const float matrix[6], int32_t w, int32_t h, const uint8_t* image, color_depth_t depth, const T& forecolor, const T& backcolor) { push_grayimage_affine(matrix, w, h, image, depth, convert_to_rgb888(forecolor), convert_to_rgb888(backcolor)); } +//---------------------------------------------------------------------------- + + // T == bgra8888_t or argb8888_t + template + void pushImageARGB(int32_t x, int32_t y, int32_t w, int32_t h, const T* data) + { + auto pc = create_pc(data); + if (pc.dst_bits > 16) { + if (pc.dst_depth == rgb888_3Byte) { + pc.fp_copy = pixelcopy_t::blend_rgb_fast; + } else { + pc.fp_copy = pixelcopy_t::blend_rgb_fast; + } + } else { + if (pc.dst_depth == rgb565_2Byte) { + pc.fp_copy = pixelcopy_t::blend_rgb_fast; + } else { // src_depth == rgb332_1Byte: + pc.fp_copy = pixelcopy_t::blend_rgb_fast; + } + } + pc.src_bitwidth = w; + pc.src_width = w; + pc.src_height = h; + startWrite(); + _panel->writeImageARGB(x, y, w, h, &pc); + endWrite(); + } + //---------------------------------------------------------------------------- /// read RGB565 16bit color diff --git a/src/lgfx/v1/misc/common_function.cpp b/src/lgfx/v1/misc/common_function.cpp index 6ef28f4d..ffd264b7 100644 --- a/src/lgfx/v1/misc/common_function.cpp +++ b/src/lgfx/v1/misc/common_function.cpp @@ -11,7 +11,13 @@ namespace lgfx void memset_multi(uint8_t* buf, uint32_t c, size_t size, size_t length) { - if (size == 1 || ((c & 0xFF) == ((c >> 8) & 0xFF) && (size == 2 || ((c & 0xFF) == ((c >> 16) & 0xFF))))) + if (size == 1 + || ( (c & 0xFF) == ((c >> 8) & 0xFF) + && ( size == 2 + || ( (c & 0xFF) == ((c >> 16) & 0xFF) + && ( size == 3 + || ( (c & 0xFF) == ((c >> 24) & 0xFF) + )))))) { memset(buf, c, size * length); return; diff --git a/src/lgfx/v1/misc/pixelcopy.hpp b/src/lgfx/v1/misc/pixelcopy.hpp index 6a4147ee..fa7a46fa 100644 --- a/src/lgfx/v1/misc/pixelcopy.hpp +++ b/src/lgfx/v1/misc/pixelcopy.hpp @@ -449,13 +449,13 @@ namespace lgfx return last; } - template + template static uint32_t blend_rgb_fast(void* __restrict dst, uint32_t index, uint32_t last, pixelcopy_t* __restrict param) { auto d = static_cast(dst); auto src_x32_add = param->src_x32_add; auto src_y32_add = param->src_y32_add; - auto s = static_cast(param->src_data); + auto s = static_cast(param->src_data); for (;;) { uint32_t i = param->src_x + param->src_y * param->src_bitwidth; uint_fast16_t a = s[i].a; @@ -463,7 +463,7 @@ namespace lgfx { if (a == 255) { - d[index].set(s[i].r, s[i].g, s[i].b); + d[index].set(s[i].R8(), s[i].G8(), s[i].B8()); param->src_x32 += src_x32_add; param->src_y32 += src_y32_add; if (++index == last) return last;