This commit is contained in:
Isaac Connor 2021-12-10 16:19:41 -05:00
parent 327f481893
commit b7b49437b9
1 changed files with 20 additions and 27 deletions

View File

@ -118,39 +118,32 @@ constexpr Rgb kRGBTransparent = 0x01000000;
/* Convert RGB colour value into BGR\ARGB\ABGR */ /* Convert RGB colour value into BGR\ARGB\ABGR */
inline Rgb rgb_convert(Rgb p_col, int p_subpixorder) { inline Rgb rgb_convert(Rgb p_col, int p_subpixorder) {
Rgb result; Rgb result = 0;
switch(p_subpixorder) {
switch (p_subpixorder) {
case ZM_SUBPIX_ORDER_BGR: case ZM_SUBPIX_ORDER_BGR:
case ZM_SUBPIX_ORDER_BGRA: case ZM_SUBPIX_ORDER_BGRA:
{ BLUE_PTR_BGRA(&result) = BLUE_VAL_RGBA(p_col);
BLUE_PTR_BGRA(&result) = BLUE_VAL_RGBA(p_col); GREEN_PTR_BGRA(&result) = GREEN_VAL_RGBA(p_col);
GREEN_PTR_BGRA(&result) = GREEN_VAL_RGBA(p_col); RED_PTR_BGRA(&result) = RED_VAL_RGBA(p_col);
RED_PTR_BGRA(&result) = RED_VAL_RGBA(p_col); break;
}
break;
case ZM_SUBPIX_ORDER_ARGB: case ZM_SUBPIX_ORDER_ARGB:
{ BLUE_PTR_ARGB(&result) = BLUE_VAL_RGBA(p_col);
BLUE_PTR_ARGB(&result) = BLUE_VAL_RGBA(p_col); GREEN_PTR_ARGB(&result) = GREEN_VAL_RGBA(p_col);
GREEN_PTR_ARGB(&result) = GREEN_VAL_RGBA(p_col); RED_PTR_ARGB(&result) = RED_VAL_RGBA(p_col);
RED_PTR_ARGB(&result) = RED_VAL_RGBA(p_col); break;
}
break;
case ZM_SUBPIX_ORDER_ABGR: case ZM_SUBPIX_ORDER_ABGR:
{ BLUE_PTR_ABGR(&result) = BLUE_VAL_RGBA(p_col);
BLUE_PTR_ABGR(&result) = BLUE_VAL_RGBA(p_col); GREEN_PTR_ABGR(&result) = GREEN_VAL_RGBA(p_col);
GREEN_PTR_ABGR(&result) = GREEN_VAL_RGBA(p_col); RED_PTR_ABGR(&result) = RED_VAL_RGBA(p_col);
RED_PTR_ABGR(&result) = RED_VAL_RGBA(p_col); break;
} /* Grayscale */
break;
/* Grayscale */
case ZM_SUBPIX_ORDER_NONE: case ZM_SUBPIX_ORDER_NONE:
result = p_col & 0xff; result = p_col & 0xff;
break; break;
default: default:
return p_col; result = p_col;
break; break;
} }
return result; return result;