aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-04-27 11:25:24 +1000
committerNeil <nyamatongwe@gmail.com>2019-04-27 11:25:24 +1000
commit55735ff858696426509af625a56f3bea8c37d00d (patch)
tree9bdfad92a714bcf197a19d171fb4dda7843d59f4 /win32/PlatWin.cxx
parent951a1102da2095604232a3efc76846f1f7de004a (diff)
downloadscintilla-mirror-55735ff858696426509af625a56f3bea8c37d00d.tar.gz
Backport: 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. Backport of changeset 7474:6bb2a6d284d9.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx19
1 files changed, 7 insertions, 12 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 2b807198a..d0a4f4fdd 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -422,7 +422,6 @@ class SurfaceGDI : public Surface {
HPEN penOld{};
HBRUSH brush{};
HBRUSH brushOld{};
- HFONT font{};
HFONT fontOld{};
HBITMAP bitmap{};
HBITMAP bitmapOld{};
@@ -513,7 +512,6 @@ void SurfaceGDI::Clear() noexcept {
::SelectObject(hdc, fontOld);
fontOld = 0;
}
- font = 0;
if (bitmapOld) {
::SelectObject(hdc, bitmapOld);
::DeleteObject(bitmap);
@@ -583,16 +581,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);
}
}
@@ -951,7 +947,6 @@ void SurfaceGDI::SetClip(PRectangle rc) {
void SurfaceGDI::FlushCachedState() {
pen = 0;
brush = 0;
- font = 0;
}
void SurfaceGDI::SetUnicodeMode(bool unicodeMode_) {