1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX
11 #define INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX
14 #include <vcl/dllapi.h>
16 #include <openglgdiimpl.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
;
27 WinSalGraphics
& mrWinParent
;
29 bool RenderCompatibleDC(OpenGLCompatibleDC
& rWhite
, OpenGLCompatibleDC
& rBlack
,
30 int nX
, int nY
, TextureCombo
& rCombo
);
33 WinOpenGLSalGraphicsImpl(WinSalGraphics
& rGraphics
,
34 SalGeometryProvider
*mpProvider
);
37 virtual rtl::Reference
<OpenGLContext
> CreateWinContext() override
;
39 bool RenderTextureCombo(TextureCombo
const & rCombo
, int nX
, int nY
);
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
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());
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
;
76 static ControlCacheType
& get();
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */