From b655ec9fbc090306549d632f27468a58211c3c60 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 27 Apr 2019 11:25:24 +1000 Subject: Feature [feature-requests:#1279]. Removed invalid check when avoiding SelectFont if font not changed. Didn't correct the check as its not justified by minimal performance benefit so removed the supporting variable. --- win32/PlatWin.cxx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 709c876b4..31e97ea0f 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -423,7 +423,6 @@ class SurfaceGDI : public Surface { HPEN penOld{}; HBRUSH brush{}; HBRUSH brushOld{}; - HFONT font{}; HFONT fontOld{}; HBITMAP bitmap{}; HBITMAP bitmapOld{}; @@ -517,7 +516,6 @@ void SurfaceGDI::Clear() noexcept { ::SelectObject(hdc, fontOld); fontOld = 0; } - font = 0; if (bitmapOld) { ::SelectObject(hdc, bitmapOld); ::DeleteObject(bitmap); @@ -587,16 +585,14 @@ void SurfaceGDI::BrushColor(ColourDesired back) { brush = ::CreateSolidBrush(colourNearest.AsInteger()); brushOld = SelectBrush(hdc, brush); } + void SurfaceGDI::SetFont(Font &font_) { - if (font_.GetID() != font) { - const FormatAndMetrics *pfm = FamFromFontID(font_.GetID()); - PLATFORM_ASSERT(pfm->technology == SCWIN_TECH_GDI); - if (fontOld) { - SelectFont(hdc, pfm->hfont); - } else { - fontOld = SelectFont(hdc, pfm->hfont); - } - font = pfm->hfont; + const FormatAndMetrics *pfm = FamFromFontID(font_.GetID()); + PLATFORM_ASSERT(pfm->technology == SCWIN_TECH_GDI); + if (fontOld) { + SelectFont(hdc, pfm->hfont); + } else { + fontOld = SelectFont(hdc, pfm->hfont); } } @@ -960,7 +956,6 @@ void SurfaceGDI::SetClip(PRectangle rc) { void SurfaceGDI::FlushCachedState() { pen = 0; brush = 0; - font = 0; } void SurfaceGDI::SetUnicodeMode(bool unicodeMode_) { -- cgit v1.2.3