[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - vcl/win

2020-05-12 Thread Thorsten Behrens (via logerrit)
 vcl/win/gdi/salfont.cxx |   19 +++
 1 file changed, 19 insertions(+)

New commits:
commit f58aec2788ab5675cb6ffe411bd5e55a7f2a156d
Author: Thorsten Behrens 
AuthorDate: Mon May 11 23:47:21 2020 +0200
Commit: Thorsten Behrens 
CommitDate: Tue May 12 16:38:02 2020 +0200

tdf#108608 more Draw text editing responsiveness fixes

Turns out Windows is rather slow at calculating glyph outlines
(compared to Linux), I'm guessing it does no caching at all, so
just add our own little cache.

This re-introduces the initial, simple glyph rect cache from
https://gerrit.libreoffice.org/52623, but amended with fixes
for:
- tdf#120204 and duplicates
- tdf#119829 and duplicates

This partially reverts commit ac39aba9b2d08b061b0eef651f5ebc7a84391171.

Change-Id: I9445604139a2d7242969a225d9cf2967316c3608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94029
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 11957c7043dc..378fd287fc9f 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -58,6 +58,11 @@
 
 using namespace vcl;
 
+// GetGlyphOutlineW() seems to be a little slow, and doesn't seem to do its 
own caching (tested on Windows10).
+// TODO include the font as part of the cache key, then we won't need to clear 
it on font change
+// The cache limit is set by the rough number of characters needed to read 
your average Asian newspaper.
+static o3tl::lru_map g_BoundRectCache(3000);
+
 static const int MAXFONTHEIGHT = 2048;
 
 inline FIXED FixedFromDouble( double d )
@@ -848,6 +853,8 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const 
* i_pFont,
 float& o_rFontScale,
 HFONT& o_rOldFont)
 {
+// clear the cache on font change - tdf#119829
+g_BoundRectCache.clear();
 HFONT hNewFont = nullptr;
 
 LOGFONTW aLogFont;
@@ -909,6 +916,9 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const 
* i_pFont,
 
 void WinSalGraphics::SetFont( const FontSelectPattern* pFont, int 
nFallbackLevel )
 {
+// clear the cache on font change - tdf#119829
+g_BoundRectCache.clear();
+
 // return early if there is no new font
 if( !pFont )
 {
@@ -1380,6 +1390,13 @@ void WinSalGraphics::ClearDevFontCache()
 
 bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, 
tools::Rectangle& rRect)
 {
+auto it = g_BoundRectCache.find(rGlyph.maGlyphId);
+if (it != g_BoundRectCache.end())
+{
+rRect = it->second;
+return true;
+}
+
 WinFontInstance* pFont = mpWinFontEntry[rGlyph.mnFallbackLevel];
 HFONT hNewFont = pFont ? pFont->GetHFONT() : 
mhFonts[rGlyph.mnFallbackLevel];
 float fFontScale = pFont ? pFont->GetScale() : 
mfFontScale[rGlyph.mnFallbackLevel];
@@ -1413,6 +1430,8 @@ bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& 
rGlyph, tools::Rectangle
 rRect.SetTop(static_cast( fFontScale * rRect.Top() ));
 rRect.SetBottom(static_cast( fFontScale * rRect.Bottom() ) + 1);
 
+g_BoundRectCache.insert({rGlyph.maGlyphId, rRect});
+
 return true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - vcl/win

2019-09-05 Thread Armin Le Grand (via logerrit)
 vcl/win/gdi/gdiimpl.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit f101de99ff7d23b7e4316cfe463a3a7f6dc5dc07
Author: Armin Le Grand 
AuthorDate: Fri Jan 11 17:59:59 2019 +0100
Commit: Juergen Funk (CIB) 
CommitDate: Thu Sep 5 08:51:38 2019 +0200

tdf#122384 Added isPrinter support to WinSalGraphicsImpl::drawPolyLine

trac#29436

As already guessed but not been sure (see 'One more hint'
in WinSalGraphicsImpl::drawPolyPolygon) the strange WinGDI
transform is also needed when printing for WinSalGraphicsImpl::
drawPolyLine.

Change-Id: I39f89eac0c17e524949221306723a355c6e94a17
Reviewed-on: https://gerrit.libreoffice.org/66190
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 
(cherry picked from commit 6e3c4ae8bca898700cde9caaff43c3a8a61eebc2)
Reviewed-on: https://gerrit.libreoffice.org/78623
Reviewed-by: Juergen Funk (CIB) 
Tested-by: Juergen Funk (CIB) 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 69da79a8a4a4..ffbde0a37cb1 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2318,6 +2318,21 @@ bool WinSalGraphicsImpl::drawPolyLine(
 aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone);
 }
 
+if(mrParent.isPrinter())
+{
+// tdf#122384 As metioned above in WinSalGraphicsImpl::drawPolyPolygon
+// (look for 'One more hint: This *may* also be needed now in'...).
+// See comments in same spot above *uregntly* before doing changes 
here,
+// these comments are *still fully valid* at this place (!)
+const Gdiplus::REAL aDpiX(aGraphics.GetDpiX());
+const Gdiplus::REAL aDpiY(aGraphics.GetDpiY());
+
+aGraphics.ScaleTransform(
+Gdiplus::REAL(100.0) / aDpiX,
+Gdiplus::REAL(100.0) / aDpiY,
+Gdiplus::MatrixOrderAppend);
+}
+
 aGraphics.DrawPath(
 ,
 &(*pGraphicsPath));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - vcl/win

2019-08-29 Thread Juergen Funk (via logerrit)
 vcl/win/gdi/salprn.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 5df61843fa1c2360f794ab74e0ac94c12764faa7
Author: Juergen Funk 
AuthorDate: Tue Aug 27 09:22:17 2019 +0200
Commit: Juergen Funk (CIB) 
CommitDate: Thu Aug 29 10:06:37 2019 +0200

tdf#127192 Printing in main thread

trac29045

the wollmux has change the dialogs form swing to the LO-Dialogs,
and when printig with MS-PDF then LO hang on this line.
The reason is wollmux run in it own thread, but this thread has
no win-message-pump, when the printer-driver would open the
FileSave-Dialog then it hangs, because the message-pump
is missing in this thread.

The swing has made it own win-message-pump for this
thread.

Reviewed-on: https://gerrit.libreoffice.org/78170
Reviewed-by: Jan-Marek Glogowski 
Reviewed-by: Juergen Funk (CIB) 
Tested-by: Juergen Funk (CIB) 
(cherry picked from commit c16bfef0d51ad903defdb2bacb4550de481d3074)

Change-Id: Ia5131464dcc5f166133a3302d29550e945dd1026
Reviewed-on: https://gerrit.libreoffice.org/78248
Reviewed-by: Juergen Funk (CIB) 
Tested-by: Juergen Funk (CIB) 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index ddf58fd7e969..aaf96785b0db 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -48,6 +48,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -1497,8 +1499,8 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
 else
 aInfo.lpszOutput = nullptr;
 
-// start Job
-int nRet = lcl_StartDocW( hDC, , this );
+// start Job, in the main thread
+int nRet = vcl::solarthread::syncExecute([hDC, this, ]() -> int { 
return lcl_StartDocW(hDC, , this); });
 
 if ( nRet <= 0 )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits