summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-03 13:38:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-04 12:32:26 +0200
commite74fd983e3195ea2867acd4b925e9899571a1651 (patch)
tree23bb8a034885cdd3724c6fc6e7810128c94f709a
parent1501df419ea4d40358d705a281fd9662088ba51e (diff)
tdf#117364 Special Character dialog grid font issues
Revert "tdf#113643 Editing tables in Impress lags terribly" This reverts commit 13a1bc409d9b2f0d14f4d316b7977b1fc2eb3c8a. Will probably need more sophisticated caching, so just revert this for now. Change-Id: I05cc26b911d3d138b57098656ea0c9c3c4e82592 Reviewed-on: https://gerrit.libreoffice.org/53784 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--vcl/inc/win/salgdi.h1
-rw-r--r--vcl/win/gdi/salfont.cxx24
-rw-r--r--vcl/win/gdi/salgdi.cxx3
3 files changed, 8 insertions, 20 deletions
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index f45d85c4c89c..23531842dde3 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -177,7 +177,6 @@ private:
RGNDATA* mpClipRgnData; // ClipRegion-Data
RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data
int mnPenWidth; // line width
- const PhysicalFontFace* mpCurrentPhysicalFontFace; // the font face currently selected into the DC
LogicalFontInstance* GetWinFontEntry(int nFallbackLevel);
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 0acdbd666bef..6fe84173c710 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -57,22 +57,10 @@
using namespace vcl;
-using BoundRectCacheKey = std::pair<PhysicalFontFace const *,sal_GlyphId>;
-namespace std
-{
- template<> struct hash<BoundRectCacheKey>
- {
- std::size_t operator()(const BoundRectCacheKey & key ) const
- {
- return std::hash<PhysicalFontFace const *>()(key.first)
- ^ std::hash<sal_GlyphId>()(key.second);
- }
- };
-};
// GetGlyphOutlineW() seems to be a little slow, and doesn't seem to do it's 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<BoundRectCacheKey, tools::Rectangle> g_BoundRectCache(3000);
+static o3tl::lru_map<sal_GlyphId, tools::Rectangle> g_BoundRectCache(3000);
static const int MAXFONTHEIGHT = 2048;
@@ -852,9 +840,10 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont, float& o_rFontScale, HFONT& o_rOldFont)
{
- mpCurrentPhysicalFontFace = i_pFont->mpFontData;
-
+ // clear the cache on font change
+ g_BoundRectCache.clear();
HFONT hNewFont = nullptr;
+
HDC hdcScreen = nullptr;
if( mbVirDev )
// only required for virtual devices, see below for details
@@ -1366,7 +1355,7 @@ void WinSalGraphics::ClearDevFontCache()
bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect)
{
- auto it = g_BoundRectCache.find({mpCurrentPhysicalFontFace,rGlyph.maGlyphId});
+ auto it = g_BoundRectCache.find(rGlyph.maGlyphId);
if (it != g_BoundRectCache.end())
{
rRect = it->second;
@@ -1397,7 +1386,8 @@ bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle
rRect.SetTop(static_cast<int>( mfCurrentFontScale * rRect.Top() ));
rRect.SetBottom(static_cast<int>( mfCurrentFontScale * rRect.Bottom() ) + 1);
- g_BoundRectCache.insert({{mpCurrentPhysicalFontFace,rGlyph.maGlyphId}, rRect});
+ g_BoundRectCache.insert({rGlyph.maGlyphId, rRect});
+
return true;
}
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 890b28cc0c57..8aa601a461b2 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -614,8 +614,7 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
mhDefFont(nullptr),
mhDefPal(nullptr),
mpStdClipRgnData(nullptr),
- mnPenWidth(GSL_PEN_WIDTH),
- mpCurrentPhysicalFontFace(nullptr)
+ mnPenWidth(GSL_PEN_WIDTH)
{
if (OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter)
mpImpl.reset(new WinOpenGLSalGraphicsImpl(*this, pProvider));