bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / opengl / win / gdiimpl.hxx
blob7bf6d8bf85d5cfa9512c95d68ce5aa486441e91e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX
11 #define INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX
13 #include <memory>
14 #include <vcl/dllapi.h>
16 #include <openglgdiimpl.hxx>
17 #include <svdata.hxx>
18 #include <win/salgdi.h>
19 #include <o3tl/lru_map.hxx>
20 #include <vcl/opengl/OpenGLContext.hxx>
21 #include <ControlCacheKey.hxx>
23 class WinOpenGLSalGraphicsImpl : public OpenGLSalGraphicsImpl
25 friend class WinLayout;
26 private:
27 WinSalGraphics& mrWinParent;
29 bool RenderCompatibleDC(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack,
30 int nX, int nY, TextureCombo& rCombo);
32 public:
33 WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics,
34 SalGeometryProvider *mpProvider);
36 protected:
37 virtual rtl::Reference<OpenGLContext> CreateWinContext() override;
39 bool RenderTextureCombo(TextureCombo const & rCombo, int nX, int nY);
41 public:
42 virtual void Init() override;
43 virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override;
46 bool TryRenderCachedNativeControl(ControlCacheKey const & rControlCacheKey, int nX, int nY);
48 bool RenderAndCacheNativeControl(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack,
49 int nX, int nY , ControlCacheKey& aControlCacheKey);
53 struct ControlCacheHashFunction
55 std::size_t operator()(ControlCacheKey const& aCache) const
57 std::size_t seed = 0;
58 boost::hash_combine(seed, aCache.mnType);
59 boost::hash_combine(seed, aCache.mnPart);
60 boost::hash_combine(seed, aCache.mnState);
61 boost::hash_combine(seed, aCache.maSize.Width());
62 boost::hash_combine(seed, aCache.maSize.Height());
63 return seed;
67 typedef std::pair<ControlCacheKey, std::unique_ptr<TextureCombo>> ControlCachePair;
68 typedef o3tl::lru_map<ControlCacheKey, std::unique_ptr<TextureCombo>, ControlCacheHashFunction> ControlCacheType;
70 class TheTextureCache {
71 ControlCacheType cache;
73 TheTextureCache();
75 public:
76 static ControlCacheType & get();
79 #endif
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */