diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-10-23 11:29:22 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-11-27 09:55:10 +0100 |
commit | 619959827003814053a5e9ec81acfd07b3aa270a (patch) | |
tree | 29d77c1bc8a45f5102b62d04211bedd3d0ae41c7 /vcl/win/gdi | |
parent | c6b50a85a2371c1f49f75d1a9fccc8548e03e02f (diff) |
implement pruning in SkiaGlobalWinGlyphCache
Currently based on identifying the SkBitmap's by their getPixels(),
but this may need changed later since it's probably going to be
more performant to use SkSurface.
Also move the cache pruning out of AllocateTexture(), as that may
possibly remove elements that would be used by DrawCachedGlyphs().
Change-Id: Ide2de752f634593b97573667af49b7aa9ec1f47f
Diffstat (limited to 'vcl/win/gdi')
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index a3bc032c4844..906f8a35349b 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -522,6 +522,11 @@ bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout) return true; } +static void PruneGlyphCache() +{ + GlobalWinGlyphCache::get()->Prune(); +} + void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout, HDC hDC, bool bUseDWrite) { TextOutRenderer &render = TextOutRenderer::get(bUseDWrite); @@ -549,8 +554,14 @@ void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) ::SelectFont(hDC, hOrigFont); } // if we can't draw the cached OpenGL glyphs, try to draw a full OpenGL layout - else if (bForceGDI || !CacheGlyphs(rLayout) || !DrawCachedGlyphs(rLayout)) + else if (!bForceGDI && CacheGlyphs(rLayout) && DrawCachedGlyphs(rLayout)) { + PruneGlyphCache(); + } + else + { + PruneGlyphCache(); // prune the cache from the failed calls above + // We have to render the text to a hidden texture, and draw it. // // Note that Windows GDI does not really support the alpha correctly |