From d25fce791312c7c6378a64909e45a942f02adacd Mon Sep 17 00:00:00 2001 From: FrankHB Date: Tue, 14 Apr 2020 18:58:23 +0800 Subject: [PATCH] =?UTF-8?q?EGE/src/ege/viewport.cpp:=20=E5=87=BD=E6=95=B0?= =?UTF-8?q?=20clearviewport=20=E4=BD=BF=E7=94=A8=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E5=A1=AB=E5=85=85=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 参见 https://github.com/wysaid/xege/pull/12 。 Signed-off-by: FrankHB --- Compatibility.md | 4 +++- EGE/src/ege/viewport.cpp | 8 +------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Compatibility.md b/Compatibility.md index 61f2bace..deec92c6 100644 --- a/Compatibility.md +++ b/Compatibility.md @@ -19,7 +19,9 @@ YEGE 以 [misakamm 的 xege](http://github.com/misakamm/xege) 为基础修改, * 撤销 14.01 的修改,和原始 misakamm/xege 的 `color_t` 一致,而不再和 `::COLORREF` 一致。 * 同时修改函数 `EGERGB` 的实现,解决和其它函数的不一致问题。 * 修改后的格式和 `YSLib::Pixel` 在 Win32 上的实现以及 [wysaid/xege pull request 12](https://github.com/wysaid/xege/pull/12) 中的像素格式保持一致,存储格式都为 BGRA8888 。 - +* 函数 `clearviewport` 使用背景颜色填充。 + * 参见 [wysaid/xege pull request 12](https://github.com/wysaid/xege/pull/12) 。 + ## 19.01 YEGE 19.01 以 YEGE 14.01 为基础修改。 diff --git a/EGE/src/ege/viewport.cpp b/EGE/src/ege/viewport.cpp index c515d57d..62e7d4e5 100644 --- a/EGE/src/ege/viewport.cpp +++ b/EGE/src/ege/viewport.cpp @@ -38,13 +38,7 @@ clearviewport(IMAGE* pimg) { ::RECT rect{0, 0, img.m_vpt.right - img.m_vpt.left, img.m_vpt.bottom - img.m_vpt.top}; - ::HBRUSH hbr_c = ::HBRUSH(::GetCurrentObject(img.getdc(), - OBJ_BRUSH)); - ::LOGBRUSH logBrush; - - ::GetObjectW(hbr_c, sizeof(logBrush), &logBrush); - - ::HBRUSH hbr(::CreateSolidBrush(logBrush.lbColor)); + const auto hbr(::CreateSolidBrush(GetBkColor(img.getdc()))); ::FillRect(img.getdc(), &rect, hbr); ::DeleteObject(hbr);