mirror of
https://github.com/openharmony/graphic_utils.git
synced 2026-07-19 08:24:45 -04:00
Description: add new viewmap
IssueNo: https://gitee.com/openharmony/graphic_ui/issues/I5TBR8 Feature or Bugfix: Bugfix Binary Source:No Signed-off-by: zhouyj <zhouyuanjie1@huawei.com>
This commit is contained in:
@@ -38,6 +38,7 @@ struct {
|
||||
}
|
||||
g_dstFunc[] = {
|
||||
{ARGB8888, LoadBuf_ARGB8888, NeonBlendRGBA, StoreBuf_ARGB8888},
|
||||
{XRGB8888, LoadBuf_XRGB8888, NeonBlendXRGB, StoreBuf_XRGB8888},
|
||||
{RGB888, LoadBuf_RGB888, NeonBlendRGB, StoreBuf_RGB888},
|
||||
{RGB565, LoadBuf_RGB565, NeonBlendRGB, StoreBuf_RGB565}
|
||||
};
|
||||
@@ -48,6 +49,7 @@ struct {
|
||||
}
|
||||
g_srcFunc[] = {
|
||||
{ARGB8888, LoadBufA_ARGB8888},
|
||||
{XRGB8888, LoadBufA_XRGB8888},
|
||||
{RGB888, LoadBufA_RGB888},
|
||||
{RGB565, LoadBufA_RGB565}
|
||||
};
|
||||
@@ -333,6 +335,12 @@ private:
|
||||
g = vdup_n_u8(color->green);
|
||||
b = vdup_n_u8(color->blue);
|
||||
a = NeonMulDiv255(vdup_n_u8(opa), vdup_n_u8(color->alpha));
|
||||
} else if (sm == XRGB8888) {
|
||||
Color32* color = reinterpret_cast<Color32*>(srcColor);
|
||||
r = vdup_n_u8(color->red);
|
||||
g = vdup_n_u8(color->green);
|
||||
b = vdup_n_u8(color->blue);
|
||||
a = vdup_n_u8(opa);
|
||||
} else if (sm == RGB888) {
|
||||
Color24* color = reinterpret_cast<Color24*>(srcColor);
|
||||
r = vdup_n_u8(color->red);
|
||||
|
||||
@@ -130,6 +130,19 @@ static inline void NeonBlendRGBA(uint8x8_t& r1, uint8x8_t& g1, uint8x8_t& b1, ui
|
||||
b1 = NeonDivInt(b, a1);
|
||||
}
|
||||
|
||||
static inline void NeonBlendXRGB(uint8x8_t& r1, uint8x8_t& g1, uint8x8_t& b1, uint8x8_t& a1,
|
||||
uint8x8_t r2, uint8x8_t g2, uint8x8_t b2, uint8x8_t a2)
|
||||
{
|
||||
uint8x8_t da = vdup_n_u8(OPA_OPAQUE) - a2;
|
||||
a1 = a1 - NeonMulDiv255(a2, a1) + a2;
|
||||
uint16x8_t r = vmull_u8(r2, a2) + vmull_u8(r1, da);
|
||||
uint16x8_t g = vmull_u8(g2, a2) + vmull_u8(g1, da);
|
||||
uint16x8_t b = vmull_u8(b2, a2) + vmull_u8(b1, da);
|
||||
r1 = NeonDivInt(r, a1);
|
||||
g1 = NeonDivInt(g, a1);
|
||||
b1 = NeonDivInt(b, a1);
|
||||
}
|
||||
|
||||
static inline void NeonBlendRGB(uint8x8_t& r1, uint8x8_t& g1, uint8x8_t& b1, uint8x8_t& a1,
|
||||
uint8x8_t r2, uint8x8_t g2, uint8x8_t b2, uint8x8_t a2)
|
||||
{
|
||||
@@ -148,6 +161,15 @@ static inline void LoadBuf_ARGB8888(uint8_t* buf, uint8x8_t& r, uint8x8_t& g, ui
|
||||
a = vBuf.val[NEON_A];
|
||||
}
|
||||
|
||||
static inline void LoadBuf_XRGB8888(uint8_t* buf, uint8x8_t& r, uint8x8_t& g, uint8x8_t& b, uint8x8_t& a)
|
||||
{
|
||||
uint8x8x4_t vBuf = vld4_u8(buf);
|
||||
r = vBuf.val[NEON_R];
|
||||
g = vBuf.val[NEON_G];
|
||||
b = vBuf.val[NEON_B];
|
||||
a = vBuf.val[NEON_A];
|
||||
}
|
||||
|
||||
static inline void LoadBuf_RGB888(uint8_t* buf, uint8x8_t& r, uint8x8_t& g, uint8x8_t& b, uint8x8_t& a)
|
||||
{
|
||||
uint8x8x3_t vBuf = vld3_u8(buf);
|
||||
@@ -181,6 +203,20 @@ static inline void LoadBufA_ARGB8888(uint8_t* buf,
|
||||
a = NeonMulDiv255(vBuf.val[NEON_A], vdup_n_u8(opa));
|
||||
}
|
||||
|
||||
static inline void LoadBufA_XRGB8888(uint8_t* buf,
|
||||
uint8x8_t& r,
|
||||
uint8x8_t& g,
|
||||
uint8x8_t& b,
|
||||
uint8x8_t& a,
|
||||
uint8_t opa)
|
||||
{
|
||||
uint8x8x4_t vBuf = vld4_u8(buf);
|
||||
r = vBuf.val[NEON_R];
|
||||
g = vBuf.val[NEON_G];
|
||||
b = vBuf.val[NEON_B];
|
||||
a = vdup_n_u8(opa);
|
||||
}
|
||||
|
||||
static inline void LoadBufA_RGB888(uint8_t* buf,
|
||||
uint8x8_t& r,
|
||||
uint8x8_t& g,
|
||||
@@ -244,6 +280,16 @@ static inline void StoreBuf_ARGB8888(uint8_t* buf, uint8x8_t& r, uint8x8_t& g, u
|
||||
vst4_u8(buf, vBuf);
|
||||
}
|
||||
|
||||
static inline void StoreBuf_XRGB8888(uint8_t* buf, uint8x8_t& r, uint8x8_t& g, uint8x8_t& b, uint8x8_t& a)
|
||||
{
|
||||
uint8x8x4_t vBuf;
|
||||
vBuf.val[NEON_R] = r;
|
||||
vBuf.val[NEON_G] = g;
|
||||
vBuf.val[NEON_B] = b;
|
||||
vBuf.val[NEON_A] = a;
|
||||
vst4_u8(buf, vBuf);
|
||||
}
|
||||
|
||||
static inline void StoreBuf_RGB888(uint8_t* buf, uint8x8_t& r, uint8x8_t& g, uint8x8_t& b, uint8x8_t& a)
|
||||
{
|
||||
uint8x8x3_t vBuf;
|
||||
|
||||
@@ -66,6 +66,8 @@ enum LabelRotateDegree : uint8_t {
|
||||
enum ColorMode : uint8_t {
|
||||
/** ARGB8888 color mode */
|
||||
ARGB8888 = 0,
|
||||
/** XRGB888 color mode */
|
||||
XRGB8888,
|
||||
/** RGB888 color mode */
|
||||
RGB888,
|
||||
/** RGB565 color mode */
|
||||
|
||||
Reference in New Issue
Block a user