From 277bd686650d71ce8079cd6f5bb5ae554a2275d2 Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 16 Jan 2019 10:58:37 +0000 Subject: [PATCH] CtrlCore: Win32 DrawTextOp MT fix git-svn-id: svn://ultimatepp.org/upp/trunk@12672 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/DrawTextWin32.cpp | 14 +++----------- uppsrc/Draw/Font.cpp | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/uppsrc/CtrlCore/DrawTextWin32.cpp b/uppsrc/CtrlCore/DrawTextWin32.cpp index 46de19531..5b535213e 100644 --- a/uppsrc/CtrlCore/DrawTextWin32.cpp +++ b/uppsrc/CtrlCore/DrawTextWin32.cpp @@ -6,27 +6,19 @@ namespace Upp { #define LLOG(x) -HFONT GetWin32Font(Font fnt, int angle); +HFONT GetWin32Font(Font fnt, int angle); +extern StaticMutex sFontLock; void SystemDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx) { Std(font); -/* while(n > 3000) { - DrawTextOp(x, y, angle, text, font, ink, 3000, dx); - if(dx) - for(int i = 0; i < 30000; i++) - x += *dx++; - else - x += GetTextSize(text, font, 3000).cx; - n -= 3000; - text += 3000; - }*/ GuiLock __; COLORREF cr = GetColor(ink); if(cr != lastTextColor) { LLOG("Setting text color: " << ink); ::SetTextColor(handle, lastTextColor = cr); } + Mutex::Lock ___(sFontLock); HGDIOBJ orgfont = ::SelectObject(handle, GetWin32Font(font, angle)); int ascent = font.Info().GetAscent(); if(angle) { diff --git a/uppsrc/Draw/Font.cpp b/uppsrc/Draw/Font.cpp index 13218e6ce..480c86ab6 100644 --- a/uppsrc/Draw/Font.cpp +++ b/uppsrc/Draw/Font.cpp @@ -4,7 +4,7 @@ namespace Upp { -static StaticMutex sFontLock; +StaticMutex sFontLock; bool Replace(Font fnt, int chr, Font& rfnt);