| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#include "lv_pxp_utils.h" |
| 17 |
|
| 18 |
#if LV_USE_PXP |
| 19 |
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
pxp_output_pixel_format_t pxp_get_out_px_format(lv_color_format_t cf) |
| 42 |
{ |
| 43 |
pxp_output_pixel_format_t out_px_format = kPXP_OutputPixelFormatRGB565; |
| 44 |
|
| 45 |
switch(cf) { |
| 46 |
case LV_COLOR_FORMAT_RGB565: |
| 47 |
out_px_format = kPXP_OutputPixelFormatRGB565; |
| 48 |
break; |
| 49 |
case LV_COLOR_FORMAT_RGB888: |
| 50 |
out_px_format = kPXP_OutputPixelFormatRGB888P; |
| 51 |
break; |
| 52 |
case LV_COLOR_FORMAT_ARGB8888: |
| 53 |
out_px_format = kPXP_OutputPixelFormatARGB8888; |
| 54 |
break; |
| 55 |
case LV_COLOR_FORMAT_XRGB8888: |
| 56 |
out_px_format = kPXP_OutputPixelFormatRGB888; |
| 57 |
break; |
| 58 |
|
| 59 |
default: |
| 60 |
PXP_ASSERT_MSG(false, "Unsupported color format."); |
| 61 |
break; |
| 62 |
} |
| 63 |
|
| 64 |
return out_px_format; |
| 65 |
} |
| 66 |
|
| 67 |
pxp_as_pixel_format_t pxp_get_as_px_format(lv_color_format_t cf) |
| 68 |
{ |
| 69 |
pxp_as_pixel_format_t as_px_format = kPXP_AsPixelFormatRGB565; |
| 70 |
|
| 71 |
switch(cf) { |
| 72 |
case LV_COLOR_FORMAT_RGB565: |
| 73 |
as_px_format = kPXP_AsPixelFormatRGB565; |
| 74 |
break; |
| 75 |
case LV_COLOR_FORMAT_RGB888: |
| 76 |
PXP_ASSERT_MSG(false, "Unsupported color format."); |
| 77 |
break; |
| 78 |
case LV_COLOR_FORMAT_ARGB8888: |
| 79 |
as_px_format = kPXP_AsPixelFormatARGB8888; |
| 80 |
break; |
| 81 |
case LV_COLOR_FORMAT_XRGB8888: |
| 82 |
as_px_format = kPXP_AsPixelFormatRGB888; |
| 83 |
break; |
| 84 |
|
| 85 |
default: |
| 86 |
PXP_ASSERT_MSG(false, "Unsupported color format."); |
| 87 |
break; |
| 88 |
} |
| 89 |
|
| 90 |
return as_px_format; |
| 91 |
} |
| 92 |
|
| 93 |
#if LV_USE_DRAW_PXP |
| 94 |
pxp_ps_pixel_format_t pxp_get_ps_px_format(lv_color_format_t cf) |
| 95 |
{ |
| 96 |
pxp_ps_pixel_format_t ps_px_format = kPXP_PsPixelFormatRGB565; |
| 97 |
|
| 98 |
switch(cf) { |
| 99 |
case LV_COLOR_FORMAT_RGB565: |
| 100 |
ps_px_format = kPXP_PsPixelFormatRGB565; |
| 101 |
break; |
| 102 |
case LV_COLOR_FORMAT_RGB888: |
| 103 |
PXP_ASSERT_MSG(false, "Unsupported color format."); |
| 104 |
break; |
| 105 |
case LV_COLOR_FORMAT_ARGB8888: |
| 106 |
#if (!(defined(FSL_FEATURE_PXP_HAS_NO_EXTEND_PIXEL_FORMAT) && FSL_FEATURE_PXP_HAS_NO_EXTEND_PIXEL_FORMAT)) && \ |
| 107 |
(!(defined(FSL_FEATURE_PXP_V3) && FSL_FEATURE_PXP_V3)) |
| 108 |
ps_px_format = kPXP_PsPixelFormatARGB8888; |
| 109 |
#else |
| 110 |
PXP_ASSERT_MSG(false, "Unsupported color format."); |
| 111 |
#endif |
| 112 |
break; |
| 113 |
case LV_COLOR_FORMAT_XRGB8888: |
| 114 |
#if (!(defined(FSL_FEATURE_PXP_HAS_NO_EXTEND_PIXEL_FORMAT) && FSL_FEATURE_PXP_HAS_NO_EXTEND_PIXEL_FORMAT)) && \ |
| 115 |
(!(defined(FSL_FEATURE_PXP_V3) && FSL_FEATURE_PXP_V3)) |
| 116 |
ps_px_format = kPXP_PsPixelFormatARGB8888; |
| 117 |
#else |
| 118 |
ps_px_format = kPXP_PsPixelFormatRGB888; |
| 119 |
#endif |
| 120 |
break; |
| 121 |
|
| 122 |
default: |
| 123 |
PXP_ASSERT_MSG(false, "Unsupported color format."); |
| 124 |
break; |
| 125 |
} |
| 126 |
|
| 127 |
return ps_px_format; |
| 128 |
} |
| 129 |
|
| 130 |
bool pxp_buf_aligned(const void * buf, uint32_t stride) |
| 131 |
{ |
| 132 |
|
| 133 |
if((uintptr_t)buf % 64) |
| 134 |
return false; |
| 135 |
|
| 136 |
|
| 137 |
if(stride == 0) |
| 138 |
return false; |
| 139 |
|
| 140 |
return true; |
| 141 |
} |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
#endif |
| 148 |
#endif |
| 149 |
#endif |