From 158f30e7a5e5eec752769c5e3e3ae89c40e2ebb0 Mon Sep 17 00:00:00 2001 From: FrankHB Date: Tue, 14 Apr 2020 17:34:04 +0800 Subject: [PATCH] =?UTF-8?q?EGE/include/ege/colorbase.h:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=A3=E7=A0=81=E7=BC=A9=E8=BF=9B=E5=92=8C=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C=EF=BC=9B=E9=A2=9C=E8=89=B2=E8=BD=AC=E6=8D=A2=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=B7=BB=E5=8A=A0=20ynothrow=20=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: FrankHB --- Compatibility.md | 1 + EGE/include/ege/colorbase.h | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Compatibility.md b/Compatibility.md index 42e9c2f4..9d1323be 100644 --- a/Compatibility.md +++ b/Compatibility.md @@ -13,6 +13,7 @@ YEGE 以 [misakamm 的 xege](http://github.com/misakamm/xege) 为基础修改, * 修复 `putimage_`* 系列函数剪裁区域和坐标变换的问题。 * 参见 [wysaid/xege pull request 5](https://github.com/wysaid/xege/pull/5) 。 * 参见 [wysaid/xege pull request 9](https://github.com/wysaid/xege/pull/9) 。 +* 颜色转换函数添加 `ynothrow` 。 ## 19.01 diff --git a/EGE/include/ege/colorbase.h b/EGE/include/ege/colorbase.h index 16878863..af1f39b7 100644 --- a/EGE/include/ege/colorbase.h +++ b/EGE/include/ege/colorbase.h @@ -30,82 +30,80 @@ using ConstBitmapPtr = const color_int_t*; #endif yconstfn color_int_t -RGBTOBGR(MonoType color) +RGBTOBGR(MonoType color) ynothrow { return ((color & 0xFF) << 16) | ((color & 0xFF0000) >> 16) - | (color & 0xFF00FF00); + | (color & 0xFF00FF00); } yconstfn color_int_t -EGERGB(MonoType r, MonoType g, MonoType b) +EGERGB(MonoType r, MonoType g, MonoType b) ynothrow { return (b << 16) | (g << 8) | r; } yconstfn color_int_t -EGERGBA(MonoType r, MonoType g, MonoType b, MonoType a) +EGERGBA(MonoType r, MonoType g, MonoType b, MonoType a) ynothrow { return EGERGB(r, g, b) | a << 24; } yconstfn color_int_t -EGEARGB(MonoType a, MonoType r, MonoType g, - MonoType b) +EGEARGB(MonoType a, MonoType r, MonoType g, MonoType b) ynothrow { return EGERGB(r, g, b) | a << 24; } - yconstfn color_int_t -EGEACOLOR(MonoType a, color_int_t color) +EGEACOLOR(MonoType a, color_int_t color) ynothrow { return (color & 0xFFFFFF) | (a << 24); } + yconstfn color_int_t -EGECOLORA(MonoType a, color_int_t color) +EGECOLORA(MonoType a, color_int_t color) ynothrow { return (color & 0xFFFFFF) | (a << 24); } - yconstfn MonoType -EGEGET_R(color_int_t c) +EGEGET_R(color_int_t c) ynothrow { return (c >> 16) & 0xFF; } yconstfn MonoType -EGEGET_G(color_int_t c) +EGEGET_G(color_int_t c) ynothrow { return (c >> 8) & 0xFF; } yconstfn MonoType -EGEGET_B(color_int_t c) +EGEGET_B(color_int_t c) ynothrow { return c & 0xFF; } yconstfn MonoType -EGEGET_A(color_int_t c) +EGEGET_A(color_int_t c) ynothrow { return (c >> 24) & 0xFF; } yconstfn color_int_t -EGEGRAY(color_int_t gray) +EGEGRAY(color_int_t gray) ynothrow { return (gray << 16) | (gray << 8) | gray; } yconstfn color_int_t -EGEGRAYA(color_int_t gray, MonoType a) +EGEGRAYA(color_int_t gray, MonoType a) ynothrow { return EGEGRAY(gray) | (a << 24); } yconstfn color_int_t -EGEAGRAY(MonoType a, color_int_t gray) +EGEAGRAY(MonoType a, color_int_t gray) ynothrow { return EGEGRAY(gray) | (a << 24); }