1 /**
2 * @file lv_blend_arm2d.h
3 *
4 */
5
6 #ifndef LV_BLEND_ARM2D_H
7 #define LV_BLEND_ARM2D_H
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12
13 /*********************
14 * INCLUDES
15 *********************/
16
17 #include "../../../../lv_conf_internal.h"
18
19 #if LV_USE_DRAW_ARM2D_SYNC
20
21 #define __ARM_2D_IMPL__
22 #include "arm_2d.h"
23 #include "__arm_2d_impl.h"
24
25 #if defined(__IS_COMPILER_ARM_COMPILER_5__)
26 #pragma diag_suppress 174,177,188,68,513,144,1296
27 #elif defined(__IS_COMPILER_IAR__)
28 #pragma diag_suppress=Pa093
29 #elif defined(__IS_COMPILER_GCC__)
30 #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
31 #endif
32
33
34 #if ARM_2D_VERSION < 10106ul
35 #error Please upgrade to Arm-2D v1.1.6 or above
36 #endif
37
38 #ifndef LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF
39 #define LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF 1
40 #endif
41
42 /*********************
43 * DEFINES
44 *********************/
45
46 #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565
47 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc) \
48 lv_color_blend_to_rgb565_arm2d(dsc)
49 #endif
50
51 #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA
52 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc) \
53 lv_color_blend_to_rgb565_with_opa_arm2d(dsc)
54 #endif
55
56 #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK
57 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc) \
58 lv_color_blend_to_rgb565_with_mask_arm2d(dsc)
59 #endif
60
61 #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA
62 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc) \
63 lv_color_blend_to_rgb565_mix_mask_opa_arm2d(dsc)
64 #endif
65
66 #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565
67 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc) \
68 lv_rgb565_blend_normal_to_rgb565_arm2d(dsc)
69 #endif
70
71 #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA
72 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \
73 lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(dsc)
74 #endif
75
76 #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK
77 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \
78 lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(dsc)
79 #endif
80
81 #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
82 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \
83 lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc)
84 #endif
85
86 #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565
87 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size) \
88 lv_rgb888_blend_normal_to_rgb565_arm2d(dsc, src_px_size)
89 #endif
90
91 #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA
92 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size) \
93 lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(dsc, src_px_size)
94 #endif
95
96 #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK
97 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size) \
98 lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(dsc, src_px_size)
99 #endif
100
101 #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
102 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc, src_px_size) \
103 lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc, src_px_size)
104 #endif
105
106 #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565
107 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc) \
108 lv_argb8888_blend_normal_to_rgb565_arm2d(dsc)
109 #endif
110
111 #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA
112 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \
113 lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(dsc)
114 #endif
115
116 #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK
117 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \
118 lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(dsc)
119 #endif
120
121 #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
122 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \
123 lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc)
124 #endif
125
126 #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888
127 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888(dsc, dst_px_size) \
128 lv_color_blend_to_rgb888_arm2d(dsc, dst_px_size)
129 #endif
130
131 #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA
132 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(dsc, dst_px_size) \
133 lv_color_blend_to_rgb888_with_opa_arm2d(dsc, dst_px_size)
134 #endif
135
136 #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK
137 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(dsc, dst_px_size) \
138 lv_color_blend_to_rgb888_with_mask_arm2d(dsc, dst_px_size)
139 #endif
140
141 #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA
142 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \
143 lv_color_blend_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size)
144 #endif
145
146 #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888
147 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \
148 lv_rgb565_blend_normal_to_rgb888_arm2d(dsc, dst_px_size)
149 #endif
150
151 #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA
152 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \
153 lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size)
154 #endif
155
156 #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK
157 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \
158 lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size)
159 #endif
160
161 #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA
162 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \
163 lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size)
164 #endif
165
166 #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888
167 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size, src_px_size) \
168 lv_rgb888_blend_normal_to_rgb888_arm2d(dsc, dst_px_size, src_px_size)
169 #endif
170
171 #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA
172 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size, src_px_size) \
173 lv_rgb888_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size, src_px_size)
174 #endif
175
176 #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK
177 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size, src_px_size) \
178 lv_rgb888_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size, src_px_size)
179 #endif
180
181 #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA
182 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size, src_px_size) \
183 lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size, src_px_size)
184 #endif
185
186 #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888
187 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \
188 lv_argb8888_blend_normal_to_rgb888_arm2d(dsc, dst_px_size)
189 #endif
190
191 #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA
192 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \
193 lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size)
194 #endif
195
196 #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK
197 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \
198 lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size)
199 #endif
200
201 #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA
202 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \
203 lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size)
204 #endif
205
206 /**********************
207 * TYPEDEFS
208 **********************/
209
210 /**********************
211 * GLOBAL PROTOTYPES
212 **********************/
213
lv_color_blend_to_rgb565_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc)214 static inline lv_result_t lv_color_blend_to_rgb565_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc)
215 {
216 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
217 int16_t stride = (dsc->dest_stride) / sizeof(uint16_t);
218 __arm_2d_impl_rgb16_colour_filling((uint16_t *)dsc->dest_buf,
219 stride,
220 &draw_size,
221 lv_color_to_u16(dsc->color));
222 return LV_RESULT_OK;
223 }
224
lv_color_blend_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc)225 static inline lv_result_t lv_color_blend_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc)
226 {
227 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
228 int16_t stride = (dsc->dest_stride) / sizeof(uint16_t);
229 __arm_2d_impl_rgb565_colour_filling_with_opacity((uint16_t *)dsc->dest_buf,
230 stride,
231 &draw_size,
232 lv_color_to_u16(dsc->color),
233 dsc->opa);
234 return LV_RESULT_OK;
235 }
236
lv_color_blend_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc)237 static inline lv_result_t lv_color_blend_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc)
238 {
239 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
240 int16_t stride = (dsc->dest_stride) / sizeof(uint16_t);
241 __arm_2d_impl_rgb565_colour_filling_mask((uint16_t *)dsc->dest_buf,
242 stride,
243 (uint8_t *)dsc->mask_buf,
244 dsc->mask_stride,
245 &draw_size,
246 lv_color_to_u16(dsc->color));
247 return LV_RESULT_OK;
248 }
249
lv_color_blend_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc)250 static inline lv_result_t lv_color_blend_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc)
251 {
252 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
253 int16_t stride = (dsc->dest_stride) / sizeof(uint16_t);
254 __arm_2d_impl_rgb565_colour_filling_mask_opacity((uint16_t *)dsc->dest_buf,
255 stride,
256 (uint8_t *)dsc->mask_buf,
257 dsc->mask_stride,
258 &draw_size,
259 lv_color_to_u16(dsc->color),
260 dsc->opa);
261 return LV_RESULT_OK;
262 }
263
lv_rgb565_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)264 static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)
265 {
266
267 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
268 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
269 int16_t src_stride = dsc->src_stride / sizeof(uint16_t);
270 __arm_2d_impl_rgb16_copy((uint16_t *)dsc->src_buf,
271 src_stride,
272 (uint16_t *)dsc->dest_buf,
273 des_stride,
274 &draw_size);
275 return LV_RESULT_OK;
276 }
277
lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)278 static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)
279 {
280 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
281 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
282 int16_t src_stride = dsc->src_stride / sizeof(uint16_t);
283 __arm_2d_impl_rgb565_tile_copy_opacity((uint16_t *)dsc->src_buf,
284 src_stride,
285 (uint16_t *)dsc->dest_buf,
286 des_stride,
287 &draw_size,
288 dsc->opa);
289 return LV_RESULT_OK;
290 }
291
lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)292 static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)
293 {
294 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
295 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
296 int16_t src_stride = dsc->src_stride / sizeof(uint16_t);
297 __arm_2d_impl_rgb565_src_msk_copy((uint16_t *)dsc->src_buf,
298 src_stride,
299 (uint8_t *)dsc->mask_buf,
300 dsc->mask_stride,
301 &draw_size,
302 (uint16_t *)dsc->dest_buf,
303 des_stride,
304 &draw_size);
305 return LV_RESULT_OK;
306 }
307
lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)308 static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)
309 {
310 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
311 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
312 int16_t src_stride = dsc->src_stride / sizeof(uint16_t);
313
314 __arm_2d_impl_rgb565_tile_copy_with_src_mask_and_opacity((uint16_t *)dsc->src_buf,
315 src_stride,
316 (uint8_t *)dsc->mask_buf,
317 dsc->mask_stride,
318 &draw_size,
319 (uint16_t *)dsc->dest_buf,
320 des_stride,
321 &draw_size,
322 dsc->opa);
323 return LV_RESULT_OK;
324 }
325
lv_rgb888_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t src_px_size)326 static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
327 uint32_t src_px_size)
328 {
329 if(src_px_size == 3) {
330 return LV_RESULT_INVALID;
331 }
332
333 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
334 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
335 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
336
337 __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf,
338 src_stride,
339 (uint16_t *)dsc->dest_buf,
340 des_stride,
341 &draw_size);
342
343 return LV_RESULT_OK;
344 }
345
lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t src_px_size)346 static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
347 uint32_t src_px_size)
348 {
349 if(src_px_size == 3) {
350 return LV_RESULT_INVALID;
351 }
352
353 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
354 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
355 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
356
357 uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h);
358 if(NULL == tmp_buf) {
359 return LV_RESULT_INVALID;
360 }
361
362 #if !LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF
363 __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf,
364 src_stride,
365 (uint16_t *)tmp_buf,
366 des_stride,
367 &draw_size);
368
369 __arm_2d_impl_rgb565_tile_copy_opacity(tmp_buf,
370 des_stride,
371 (uint16_t *)dsc->dest_buf,
372 des_stride,
373 &draw_size,
374 dsc->opa);
375 #else
376 __arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_opacity((uint32_t *)dsc->src_buf,
377 src_stride,
378 (uint16_t *)dsc->dest_buf,
379 des_stride,
380 &draw_size,
381 dsc->opa);
382 #endif
383 lv_free(tmp_buf);
384 return LV_RESULT_OK;
385 }
386
lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t src_px_size)387 static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
388 uint32_t src_px_size)
389 {
390 if(src_px_size == 3) {
391 return LV_RESULT_INVALID;
392 }
393
394 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
395 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
396 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
397
398 uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h);
399 if(NULL == tmp_buf) {
400 return LV_RESULT_INVALID;
401 }
402
403 #if !LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF
404 __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf,
405 src_stride,
406 (uint16_t *)tmp_buf,
407 des_stride,
408 &draw_size);
409
410 __arm_2d_impl_rgb565_src_msk_copy(tmp_buf,
411 des_stride,
412 (uint8_t *)dsc->mask_buf,
413 dsc->mask_stride,
414 &draw_size,
415 (uint16_t *)dsc->dest_buf,
416 des_stride,
417 &draw_size);
418 #else
419 __arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_src_mask((uint32_t *)dsc->src_buf,
420 src_stride,
421 (uint8_t *)dsc->mask_buf,
422 dsc->mask_stride,
423 &draw_size,
424 (uint16_t *)dsc->dest_buf,
425 des_stride,
426 &draw_size);
427 #endif
428
429 lv_free(tmp_buf);
430 return LV_RESULT_OK;
431 }
432
lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t src_px_size)433 static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
434 uint32_t src_px_size)
435 {
436 if(src_px_size == 3) {
437 return LV_RESULT_INVALID;
438 }
439
440 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
441 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
442 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
443
444 uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h);
445 if(NULL == tmp_buf) {
446 return LV_RESULT_INVALID;
447 }
448
449 #if !LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF
450 __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf,
451 src_stride,
452 (uint16_t *)tmp_buf,
453 des_stride,
454 &draw_size);
455
456 __arm_2d_impl_rgb565_tile_copy_with_src_mask_and_opacity(tmp_buf,
457 des_stride,
458 (uint8_t *)dsc->mask_buf,
459 dsc->mask_stride,
460 &draw_size,
461 (uint16_t *)dsc->dest_buf,
462 des_stride,
463 &draw_size,
464 dsc->opa);
465 #else
466 __arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_src_mask_and_opacity((uint32_t *)dsc->src_buf,
467 src_stride,
468 (uint8_t *)dsc->mask_buf,
469 dsc->mask_stride,
470 &draw_size,
471 (uint16_t *)dsc->dest_buf,
472 des_stride,
473 &draw_size,
474 dsc->opa);
475 #endif
476
477 lv_free(tmp_buf);
478 return LV_RESULT_OK;
479 }
480
lv_argb8888_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)481 static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)
482 {
483 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
484 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
485 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
486
487 __arm_2d_impl_ccca8888_to_rgb565((uint32_t *)dsc->src_buf,
488 src_stride,
489 (uint16_t *)dsc->dest_buf,
490 des_stride,
491 &draw_size);
492
493 return LV_RESULT_OK;
494 }
495
lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)496 static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)
497 {
498 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
499 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
500 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
501
502 __arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_opacity((uint32_t *)dsc->src_buf,
503 src_stride,
504 (uint16_t *)dsc->dest_buf,
505 des_stride,
506 &draw_size,
507 dsc->opa);
508
509 return LV_RESULT_OK;
510 }
511
lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)512 static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)
513 {
514 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
515 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
516 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
517
518 __arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_src_mask((uint32_t *)dsc->src_buf,
519 src_stride,
520 (uint8_t *)dsc->mask_buf,
521 dsc->mask_stride,
522 &draw_size,
523 (uint16_t *)dsc->dest_buf,
524 des_stride,
525 &draw_size);
526
527 return LV_RESULT_OK;
528 }
529
lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)530 static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc)
531 {
532 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
533 int16_t des_stride = dsc->dest_stride / sizeof(uint16_t);
534 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
535
536 __arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_src_mask_and_opacity((uint32_t *)dsc->src_buf,
537 src_stride,
538 (uint8_t *)dsc->mask_buf,
539 dsc->mask_stride,
540 &draw_size,
541 (uint16_t *)dsc->dest_buf,
542 des_stride,
543 &draw_size,
544 dsc->opa);
545
546 return LV_RESULT_OK;
547 }
548
lv_color_blend_to_rgb888_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc,uint32_t dst_px_size)549 static inline lv_result_t lv_color_blend_to_rgb888_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size)
550 {
551 if(dst_px_size == 3) {
552 return LV_RESULT_INVALID;
553 }
554 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
555 int16_t stride = (dsc->dest_stride) / sizeof(uint32_t);
556 __arm_2d_impl_rgb32_colour_filling((uint32_t *)dsc->dest_buf,
557 stride,
558 &draw_size,
559 lv_color_to_u32(dsc->color));
560 return LV_RESULT_OK;
561
562 }
563
lv_color_blend_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc,uint32_t dst_px_size)564 static inline lv_result_t lv_color_blend_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc,
565 uint32_t dst_px_size)
566 {
567 if(dst_px_size == 3) {
568 return LV_RESULT_INVALID;
569 }
570
571 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
572 int16_t stride = (dsc->dest_stride) / sizeof(uint32_t);
573 __arm_2d_impl_cccn888_colour_filling_with_opacity((uint32_t *)dsc->dest_buf,
574 stride,
575 &draw_size,
576 lv_color_to_u32(dsc->color),
577 dsc->opa);
578 return LV_RESULT_OK;
579 }
580
lv_color_blend_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc,uint32_t dst_px_size)581 static inline lv_result_t lv_color_blend_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc,
582 uint32_t dst_px_size)
583 {
584
585 if(dst_px_size == 3) {
586 return LV_RESULT_INVALID;
587 }
588
589 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
590 int16_t stride = (dsc->dest_stride) / sizeof(uint32_t);
591 __arm_2d_impl_cccn888_colour_filling_mask((uint32_t *)dsc->dest_buf,
592 stride,
593 (uint8_t *)dsc->mask_buf,
594 dsc->mask_stride,
595 &draw_size,
596 lv_color_to_u32(dsc->color));
597 return LV_RESULT_OK;
598 }
599
lv_color_blend_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc,uint32_t dst_px_size)600 static inline lv_result_t lv_color_blend_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc,
601 uint32_t dst_px_size)
602 {
603
604 if(dst_px_size == 3) {
605 return LV_RESULT_INVALID;
606 }
607
608 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
609 int16_t stride = (dsc->dest_stride) / sizeof(uint32_t);
610 __arm_2d_impl_cccn888_colour_filling_mask_opacity((uint32_t *)dsc->dest_buf,
611 stride,
612 (uint8_t *)dsc->mask_buf,
613 dsc->mask_stride,
614 &draw_size,
615 lv_color_to_u32(dsc->color),
616 dsc->opa);
617 return LV_RESULT_OK;
618 }
619
lv_rgb565_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size)620 static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
621 uint32_t dst_px_size)
622 {
623
624 if(dst_px_size == 3) {
625 return LV_RESULT_INVALID;
626 }
627
628 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
629 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
630 int16_t src_stride = dsc->src_stride / sizeof(uint16_t);
631
632 __arm_2d_impl_rgb565_to_cccn888((uint16_t *)dsc->src_buf,
633 src_stride,
634 (uint32_t *)dsc->dest_buf,
635 des_stride,
636 &draw_size);
637
638 return LV_RESULT_OK;
639
640 }
641
lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size)642 static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
643 uint32_t dst_px_size)
644 {
645
646 if(dst_px_size == 3) {
647 return LV_RESULT_INVALID;
648 }
649
650 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
651 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
652 int16_t src_stride = dsc->src_stride / sizeof(uint16_t);
653
654 uint32_t * tmp_buf = (uint32_t *)lv_malloc(dsc->dest_stride * dsc->dest_h);
655 if(NULL == tmp_buf) {
656 return LV_RESULT_INVALID;
657 }
658
659 /* get rgb565 */
660 __arm_2d_impl_rgb565_to_cccn888((uint16_t *)dsc->src_buf,
661 src_stride,
662 (uint32_t *)tmp_buf,
663 des_stride,
664 &draw_size);
665
666 __arm_2d_impl_cccn888_tile_copy_opacity(tmp_buf,
667 des_stride,
668 (uint32_t *)dsc->dest_buf,
669 des_stride,
670 &draw_size,
671 dsc->opa);
672
673 lv_free(tmp_buf);
674 return LV_RESULT_OK;
675 }
676
lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size)677 static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
678 uint32_t dst_px_size)
679 {
680
681 if(dst_px_size == 3) {
682 return LV_RESULT_INVALID;
683 }
684
685 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
686 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
687 int16_t src_stride = dsc->src_stride / sizeof(uint16_t);
688
689 uint32_t * tmp_buf = (uint32_t *)lv_malloc(dsc->dest_stride * dsc->dest_h);
690 if(NULL == tmp_buf) {
691 return LV_RESULT_INVALID;
692 }
693
694 __arm_2d_impl_rgb565_to_cccn888((uint16_t *)dsc->src_buf,
695 src_stride,
696 (uint32_t *)tmp_buf,
697 des_stride,
698 &draw_size);
699
700 __arm_2d_impl_cccn888_src_msk_copy(tmp_buf,
701 des_stride,
702 (uint8_t *)dsc->mask_buf,
703 dsc->mask_stride,
704 &draw_size,
705 (uint32_t *)dsc->dest_buf,
706 des_stride,
707 &draw_size);
708
709 lv_free(tmp_buf);
710 return LV_RESULT_OK;
711 }
712
lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size)713 static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
714 uint32_t dst_px_size)
715 {
716
717 if(dst_px_size == 3) {
718 return LV_RESULT_INVALID;
719 }
720
721 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
722 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
723 int16_t src_stride = dsc->src_stride / sizeof(uint16_t);
724
725 uint32_t * tmp_buf = (uint32_t *)lv_malloc(dsc->dest_stride * dsc->dest_h);
726 if(NULL == tmp_buf) {
727 return LV_RESULT_INVALID;
728 }
729
730 __arm_2d_impl_rgb565_to_cccn888((uint16_t *)dsc->src_buf,
731 src_stride,
732 (uint32_t *)tmp_buf,
733 des_stride,
734 &draw_size);
735
736 __arm_2d_impl_cccn888_tile_copy_with_src_mask_and_opacity(tmp_buf,
737 des_stride,
738 (uint8_t *)dsc->mask_buf,
739 dsc->mask_stride,
740 &draw_size,
741 (uint32_t *)dsc->dest_buf,
742 des_stride,
743 &draw_size,
744 dsc->opa);
745
746 lv_free(tmp_buf);
747 return LV_RESULT_OK;
748 }
749
lv_rgb888_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size,uint32_t src_px_size)750 static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
751 uint32_t dst_px_size,
752 uint32_t src_px_size)
753 {
754 if((dst_px_size == 3) || (src_px_size == 3)) {
755 return LV_RESULT_INVALID;
756 }
757
758 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
759 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
760 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
761
762 __arm_2d_impl_rgb32_copy((uint32_t *)dsc->src_buf,
763 src_stride,
764 (uint32_t *)dsc->dest_buf,
765 des_stride,
766 &draw_size);
767
768 return LV_RESULT_OK;
769 }
770
lv_rgb888_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size,uint32_t src_px_size)771 static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
772 uint32_t dst_px_size, uint32_t src_px_size)
773 {
774 if((dst_px_size == 3) || (src_px_size == 3)) {
775 return LV_RESULT_INVALID;
776 }
777
778 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
779 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
780 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
781
782 __arm_2d_impl_cccn888_tile_copy_opacity((uint32_t *)dsc->src_buf,
783 src_stride,
784 (uint32_t *)dsc->dest_buf,
785 des_stride,
786 &draw_size,
787 dsc->opa);
788
789 return LV_RESULT_OK;
790 }
791
lv_rgb888_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size,uint32_t src_px_size)792 static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
793 uint32_t dst_px_size, uint32_t src_px_size)
794 {
795 if((dst_px_size == 3) || (src_px_size == 3)) {
796 return LV_RESULT_INVALID;
797 }
798
799 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
800 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
801 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
802
803 __arm_2d_impl_cccn888_src_msk_copy((uint32_t *)dsc->src_buf,
804 src_stride,
805 (uint8_t *)dsc->mask_buf,
806 dsc->mask_stride,
807 &draw_size,
808 (uint32_t *)dsc->dest_buf,
809 des_stride,
810 &draw_size);
811 return LV_RESULT_OK;
812 }
813
lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size,uint32_t src_px_size)814 static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
815 uint32_t dst_px_size, uint32_t src_px_size)
816 {
817 if((dst_px_size == 3) || (src_px_size == 3)) {
818 return LV_RESULT_INVALID;
819 }
820
821 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
822 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
823 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
824
825 __arm_2d_impl_cccn888_tile_copy_with_src_mask_and_opacity((uint32_t *)dsc->src_buf,
826 src_stride,
827 (uint8_t *)dsc->mask_buf,
828 dsc->mask_stride,
829 &draw_size,
830 (uint32_t *)dsc->dest_buf,
831 des_stride,
832 &draw_size,
833 dsc->opa);
834 return LV_RESULT_OK;
835 }
836
lv_argb8888_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size)837 static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
838 uint32_t dst_px_size)
839 {
840
841 if(dst_px_size == 3) {
842 return LV_RESULT_INVALID;
843 }
844
845 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
846 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
847 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
848
849 __arm_2d_impl_ccca8888_to_cccn888((uint32_t *)dsc->src_buf,
850 src_stride,
851 (uint32_t *)dsc->dest_buf,
852 des_stride,
853 &draw_size);
854
855 return LV_RESULT_OK;
856 }
857
lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size)858 static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
859 uint32_t dst_px_size)
860 {
861 if(dst_px_size == 3) {
862 return LV_RESULT_INVALID;
863 }
864
865 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
866 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
867 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
868
869 __arm_2d_impl_ccca8888_tile_copy_to_cccn888_with_opacity((uint32_t *)dsc->src_buf,
870 src_stride,
871 (uint32_t *)dsc->dest_buf,
872 des_stride,
873 &draw_size,
874 dsc->opa);
875
876 return LV_RESULT_OK;
877 }
878
lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size)879 static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
880 uint32_t dst_px_size)
881 {
882
883 if(dst_px_size == 3) {
884 return LV_RESULT_INVALID;
885 }
886
887 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
888 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
889 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
890
891 __arm_2d_impl_ccca8888_tile_copy_to_cccn888_with_src_mask((uint32_t *)dsc->src_buf,
892 src_stride,
893 (uint8_t *)dsc->mask_buf,
894 dsc->mask_stride,
895 &draw_size,
896 (uint32_t *)dsc->dest_buf,
897 des_stride,
898 &draw_size);
899
900 return LV_RESULT_OK;
901 }
902
lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,uint32_t dst_px_size)903 static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc,
904 uint32_t dst_px_size)
905 {
906 if(dst_px_size == 3) {
907 return LV_RESULT_INVALID;
908 }
909
910 arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h};
911 int16_t des_stride = dsc->dest_stride / sizeof(uint32_t);
912 int16_t src_stride = dsc->src_stride / sizeof(uint32_t);
913
914 __arm_2d_impl_ccca8888_tile_copy_to_cccn888_with_src_mask_and_opacity((uint32_t *)dsc->src_buf,
915 src_stride,
916 (uint8_t *)dsc->mask_buf,
917 dsc->mask_stride,
918 &draw_size,
919 (uint32_t *)dsc->dest_buf,
920 des_stride,
921 &draw_size,
922 dsc->opa);
923
924 return LV_RESULT_OK;
925 }
926
927 /**********************
928 * MACROS
929 **********************/
930
931 #endif /* LV_USE_DRAW_ARM2D_SYNC */
932
933 #ifdef __cplusplus
934 } /*extern "C"*/
935 #endif
936
937 #endif /*LV_BLEND_ARM2D_H*/
938