diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-07-23 19:15:20 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-07-24 19:15:00 +0900 |
commit | 450727fdffa4a0dc3b2d4e635a5c1bc0411b3c36 (patch) | |
tree | 190bc9941d55a7706becf9acfe8940d468b5a6e2 /include | |
parent | 79ebd13ffa69b6076d663089ba13f814aa80bcff (diff) |
tdf#92018 cache native controls for X11 OpenGL backend (for now)
Change-Id: I85c7cc01113bc4ac810c450a6460059463cc8e03
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/salnativewidgets.hxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx index 5177efeb3f64..8118b299dba8 100644 --- a/include/vcl/salnativewidgets.hxx +++ b/include/vcl/salnativewidgets.hxx @@ -25,6 +25,8 @@ #include <tools/gen.hxx> #include <o3tl/typed_flags_set.hxx> +#include <boost/functional/hash.hpp> + /* Control Types: * * Specify the overall, whole control @@ -254,6 +256,46 @@ namespace o3tl template<> struct typed_flags<ControlState> : is_typed_flags<ControlState, 0xc007f> {}; } +class ControlCacheKey +{ +public: + ControlType mnType; + ControlPart mnPart; + ControlState mnState; + Size maSize; + + ControlCacheKey(ControlType nType, ControlPart nPart, ControlState nState, const Size& rSize) + : mnType(nType) + , mnPart(nPart) + , mnState(nState) + , maSize(rSize) + {} + + bool operator==(ControlCacheKey const& aOther) const + { + return mnType == aOther.mnType + && mnPart == aOther.mnPart + && mnState == aOther.mnState + && maSize.Width() == aOther.maSize.Width() + && maSize.Height() == aOther.maSize.Height(); + } +}; + +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; + } +}; + + /* ButtonValue: * * Identifies the tri-state value options |