[Libreoffice-commits] core.git: vcl/inc vcl/win
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Oct 6 08:07:08 UTC 2018
vcl/inc/win/saldata.hxx | 4 ++--
vcl/inc/win/winlayout.hxx | 37 +++++++++++++++++++------------------
vcl/win/gdi/winlayout.cxx | 16 ++++++++--------
3 files changed, 29 insertions(+), 28 deletions(-)
New commits:
commit 7d8a756164dda3b5b08eef68a2925fa4704c33ab
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Oct 5 09:41:32 2018 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sat Oct 6 10:06:44 2018 +0200
WIN rename GlyphCache to OpenGLGlyphCache
The Windows-backend based GlyphCache is OpenGL specific, so
reflect that by renaming it.
Change-Id: I1034bfde14792f0b6a807f8e938742556a31fcfb
Reviewed-on: https://gerrit.libreoffice.org/61452
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index ae43b12af4ab..d036ffb30a23 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -38,7 +38,7 @@ class WinSalFrame;
class WinSalVirtualDevice;
class WinSalPrinter;
namespace vcl { class Font; }
-struct GlobalGlyphCache;
+struct GlobalOpenGLGlyphCache;
struct HDCCache;
struct TempFontItem;
class TextOutRenderer;
@@ -121,7 +121,7 @@ public:
std::unique_ptr<TextOutRenderer> m_pD2DWriteTextOutRenderer;
// tdf#107205 need 2 instances because D2DWrite can't rotate text
std::unique_ptr<TextOutRenderer> m_pExTextOutRenderer;
- std::unique_ptr<GlobalGlyphCache> m_pGlobalGlyphCache;
+ std::unique_ptr<GlobalOpenGLGlyphCache> m_pGlobalOpenGLGlyphCache;
std::unique_ptr<TheTextureCache> m_pTextureCache;
};
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index b08a5d0ab78f..036c1d3bcbbd 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -58,48 +58,48 @@ struct OpenGLGlyphDrawElement
}
};
-class GlyphCache;
+class OpenGLGlyphCache;
-struct GlobalGlyphCache
+struct GlobalOpenGLGlyphCache
{
- GlobalGlyphCache()
+ GlobalOpenGLGlyphCache()
: maPackedTextureAtlas(2048, 2048)
{}
PackedTextureAtlasManager maPackedTextureAtlas;
- std::unordered_set<GlyphCache*> maGlyphCaches;
+ std::unordered_set<OpenGLGlyphCache*> maOpenGLGlyphCaches;
- static GlobalGlyphCache * get();
+ static GlobalOpenGLGlyphCache * get();
};
-class GlyphCache
+class OpenGLGlyphCache
{
private:
std::unordered_map<int, OpenGLGlyphDrawElement> maOpenGLTextureCache;
public:
- GlyphCache()
+ OpenGLGlyphCache()
{
- GlobalGlyphCache::get()->maGlyphCaches.insert(this);
+ GlobalOpenGLGlyphCache::get()->maOpenGLGlyphCaches.insert(this);
}
- ~GlyphCache()
+ ~OpenGLGlyphCache()
{
- GlobalGlyphCache::get()->maGlyphCaches.erase(this);
+ GlobalOpenGLGlyphCache::get()->maOpenGLGlyphCaches.erase(this);
}
static bool ReserveTextureSpace(OpenGLGlyphDrawElement& rElement, int nWidth, int nHeight)
{
- GlobalGlyphCache* pGlobalGlyphCache = GlobalGlyphCache::get();
- rElement.maTexture = pGlobalGlyphCache->maPackedTextureAtlas.Reserve(nWidth, nHeight);
+ GlobalOpenGLGlyphCache* pGlobalOpenGLGlyphCache = GlobalOpenGLGlyphCache::get();
+ rElement.maTexture = pGlobalOpenGLGlyphCache->maPackedTextureAtlas.Reserve(nWidth, nHeight);
if (!rElement.maTexture)
return false;
- std::vector<GLuint> aTextureIDs = pGlobalGlyphCache->maPackedTextureAtlas.ReduceTextureNumber(8);
+ std::vector<GLuint> aTextureIDs = pGlobalOpenGLGlyphCache->maPackedTextureAtlas.ReduceTextureNumber(8);
if (!aTextureIDs.empty())
{
- for (auto& pGlyphCache: pGlobalGlyphCache->maGlyphCaches)
+ for (auto& pOpenGLGlyphCache: pGlobalOpenGLGlyphCache->maOpenGLGlyphCaches)
{
- pGlyphCache->RemoveTextures(aTextureIDs);
+ pOpenGLGlyphCache->RemoveTextures(aTextureIDs);
}
}
return true;
@@ -150,8 +150,6 @@ class WinFontInstance : public LogicalFontInstance
public:
virtual ~WinFontInstance() override;
- bool CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, SalGraphics& rGraphics);
- GlyphCache& GetGlyphCache() { return maGlyphCache; }
bool hasHScale() const;
void SetGraphics(WinSalGraphics*);
@@ -166,6 +164,9 @@ public:
const WinFontFace * GetFontFace() const { return static_cast<const WinFontFace *>(LogicalFontInstance::GetFontFace()); }
+ bool CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, SalGraphics& rGraphics);
+ OpenGLGlyphCache& GetOpenGLGlyphCache() { return maOpenGLGlyphCache; }
+
private:
explicit WinFontInstance(const WinFontFace&, const FontSelectPattern&);
@@ -174,7 +175,7 @@ private:
WinSalGraphics *m_pGraphics;
HFONT m_hFont;
float m_fScale;
- GlyphCache maGlyphCache;
+ OpenGLGlyphCache maOpenGLGlyphCache;
};
class TextOutRenderer
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 84cc3600de3b..35303fc5c8a5 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -48,12 +48,12 @@
#include <shlwapi.h>
#include <winver.h>
-GlobalGlyphCache * GlobalGlyphCache::get() {
+GlobalOpenGLGlyphCache * GlobalOpenGLGlyphCache::get() {
SalData * data = GetSalData();
- if (!data->m_pGlobalGlyphCache) {
- data->m_pGlobalGlyphCache.reset(new GlobalGlyphCache);
+ if (!data->m_pGlobalOpenGLGlyphCache) {
+ data->m_pGlobalOpenGLGlyphCache.reset(new GlobalOpenGLGlyphCache);
}
- return data->m_pGlobalGlyphCache.get();
+ return data->m_pGlobalOpenGLGlyphCache.get();
}
bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, SalGraphics& rGraphics)
@@ -200,12 +200,12 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, S
pTxt->ReleaseFont();
- if (!GlyphCache::ReserveTextureSpace(aElement, nBitmapWidth, nBitmapHeight))
+ if (!OpenGLGlyphCache::ReserveTextureSpace(aElement, nBitmapWidth, nBitmapHeight))
return false;
if (!aDC.copyToTexture(aElement.maTexture))
return false;
- maGlyphCache.PutDrawElementInCache(aElement, nGlyphIndex);
+ maOpenGLGlyphCache.PutDrawElementInCache(aElement, nGlyphIndex);
SelectFont(aDC.getCompatibleHDC(), hOrigFont);
@@ -418,7 +418,7 @@ bool WinSalGraphics::CacheGlyphs(const GenericSalLayout& rLayout)
const GlyphItem* pGlyph;
while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
{
- if (!rFont.GetGlyphCache().IsGlyphCached(pGlyph->maGlyphId))
+ if (!rFont.GetOpenGLGlyphCache().IsGlyphCached(pGlyph->maGlyphId))
{
if (!rFont.CacheGlyphToAtlas(hDC, hFONT, pGlyph->maGlyphId, *this))
return false;
@@ -449,7 +449,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout)
const GlyphItem* pGlyph;
while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
{
- OpenGLGlyphDrawElement& rElement(rFont.GetGlyphCache().GetDrawElement(pGlyph->maGlyphId));
+ OpenGLGlyphDrawElement& rElement(rFont.GetOpenGLGlyphCache().GetDrawElement(pGlyph->maGlyphId));
OpenGLTexture& rTexture = rElement.maTexture;
if (!rTexture)
More information about the Libreoffice-commits
mailing list