summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-10-31 11:47:18 +0100
committerLuboš Luňák <l.lunak@collabora.com>2019-11-27 09:55:13 +0100
commit31b2c10484fc265ff0f05ce405c2ed5b982f8714 (patch)
treec2417156e30bff34610ca49943a73794d21adea4 /vcl/inc
parent840f55c0f6e21d00b51e4a52824c7eb7f938122f (diff)
implement Skia native controls drawing/caching for Windows
This actually fixes a number of drawing problems (e.g. highlight in popup menus), it seems the other code path is buggy. Change-Id: Iea697f577d08d20e338224d5ff5b3bf7b653f8d1
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/ControlCacheKey.hxx15
-rw-r--r--vcl/inc/opengl/win/gdiimpl.hxx26
-rw-r--r--vcl/inc/skia/win/gdiimpl.hxx19
-rw-r--r--vcl/inc/win/saldata.hxx6
4 files changed, 44 insertions, 22 deletions
diff --git a/vcl/inc/ControlCacheKey.hxx b/vcl/inc/ControlCacheKey.hxx
index 11d4ce07d719..06a1ff97bd8d 100644
--- a/vcl/inc/ControlCacheKey.hxx
+++ b/vcl/inc/ControlCacheKey.hxx
@@ -22,6 +22,7 @@
#include <tools/gen.hxx>
#include <vcl/salnativewidgets.hxx>
+#include <boost/functional/hash.hpp>
class ControlCacheKey
{
@@ -76,4 +77,18 @@ public:
}
};
+struct ControlCacheHashFunction
+{
+ std::size_t operator()(ControlCacheKey const& aCache) const
+ {
+ std::size_t seed = 0;
+ boost::hash_combine(seed, aCache.mnType);
+ boost::hash_combine(seed, aCache.mnPart);
+ boost::hash_combine(seed, aCache.mnState);
+ boost::hash_combine(seed, aCache.maSize.Width());
+ boost::hash_combine(seed, aCache.maSize.Height());
+ return seed;
+ }
+};
+
#endif // INCLUDED_VCL_INC_CONTROLCACHEKEY_HXX
diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx
index 2130654a3951..98ddabbc7a53 100644
--- a/vcl/inc/opengl/win/gdiimpl.hxx
+++ b/vcl/inc/opengl/win/gdiimpl.hxx
@@ -79,30 +79,16 @@ public:
};
-struct ControlCacheHashFunction
-{
- std::size_t operator()(ControlCacheKey const& aCache) const
- {
- std::size_t seed = 0;
- boost::hash_combine(seed, aCache.mnType);
- boost::hash_combine(seed, aCache.mnPart);
- boost::hash_combine(seed, aCache.mnState);
- boost::hash_combine(seed, aCache.maSize.Width());
- boost::hash_combine(seed, aCache.maSize.Height());
- return seed;
- }
-};
-
-typedef std::pair<ControlCacheKey, std::unique_ptr<TextureCombo>> ControlCachePair;
-typedef o3tl::lru_map<ControlCacheKey, std::unique_ptr<TextureCombo>, ControlCacheHashFunction> ControlCacheType;
+typedef std::pair<ControlCacheKey, std::unique_ptr<TextureCombo>> OpenGLControlCachePair;
+typedef o3tl::lru_map<ControlCacheKey, std::unique_ptr<TextureCombo>, ControlCacheHashFunction> OpenGLControlCacheType;
-class TheTextureCache {
- ControlCacheType cache;
+class OpenGLControlsCache {
+ OpenGLControlCacheType cache;
- TheTextureCache();
+ OpenGLControlsCache();
public:
- static ControlCacheType & get();
+ static OpenGLControlCacheType & get();
};
#endif
diff --git a/vcl/inc/skia/win/gdiimpl.hxx b/vcl/inc/skia/win/gdiimpl.hxx
index 6bd52b073aa5..321f35f24366 100644
--- a/vcl/inc/skia/win/gdiimpl.hxx
+++ b/vcl/inc/skia/win/gdiimpl.hxx
@@ -16,6 +16,9 @@
#include <skia/gdiimpl.hxx>
#include <win/salgdi.h>
#include <win/wingdiimpl.hxx>
+#include <o3tl/lru_map.hxx>
+#include <ControlCacheKey.hxx>
+#include <svdata.hxx>
class ControlCacheKey;
namespace sk_app
@@ -34,6 +37,9 @@ public:
virtual bool wantsTextColorWhite() const override { return true; }
+ SkBitmap getAsBitmap();
+ SkBitmap getAsMaskBitmap();
+
struct Texture;
};
@@ -80,6 +86,19 @@ private:
std::unique_ptr<sk_app::WindowContext> mWindowContext;
};
+typedef std::pair<ControlCacheKey, SkBitmap> SkiaControlCachePair;
+typedef o3tl::lru_map<ControlCacheKey, SkBitmap, ControlCacheHashFunction> SkiaControlCacheType;
+
+class SkiaControlsCache
+{
+ SkiaControlCacheType cache;
+
+ SkiaControlsCache();
+
+public:
+ static SkiaControlCacheType& get();
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index e9889e6653d1..0e657e15ed95 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -42,7 +42,8 @@ struct GlobalWinGlyphCache;
struct HDCCache;
struct TempFontItem;
class TextOutRenderer;
-class TheTextureCache;
+class OpenGLControlsCache;
+class SkiaControlsCache;
#define MAX_STOCKPEN 4
#define MAX_STOCKBRUSH 4
@@ -123,7 +124,8 @@ public:
// tdf#107205 need 2 instances because D2DWrite can't rotate text
std::unique_ptr<TextOutRenderer> m_pExTextOutRenderer;
std::unique_ptr<GlobalWinGlyphCache> m_pGlobalWinGlyphCache;
- std::unique_ptr<TheTextureCache> m_pTextureCache;
+ std::unique_ptr<OpenGLControlsCache> m_pOpenGLControlsCache;
+ std::unique_ptr<SkiaControlsCache> m_pSkiaControlsCache;
};
inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = pData; }