diff options
author | Neil <nyamatongwe@gmail.com> | 2019-04-27 11:25:24 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-04-27 11:25:24 +1000 |
commit | b655ec9fbc090306549d632f27468a58211c3c60 (patch) | |
tree | c345718699f8584bee704a91e8060797d24d9fb4 | |
parent | 749af53f4ce6b6701f307750614f81fe59fae9a6 (diff) | |
download | scintilla-mirror-b655ec9fbc090306549d632f27468a58211c3c60.tar.gz |
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.
-rw-r--r-- | win32/PlatWin.cxx | 19 |
1 files 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_) { |