LibreOffice Module vcl (master)  1
opengl/win/gdiimpl.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #ifndef INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX
11 #define INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX
12 
13 #include <memory>
14 #include <vcl/dllapi.h>
15 
16 #include <opengl/gdiimpl.hxx>
17 #include <svdata.hxx>
18 #include <win/salgdi.h>
19 #include <win/wingdiimpl.hxx>
20 #include <o3tl/lru_map.hxx>
22 #include <ControlCacheKey.hxx>
23 
25 {
26 public:
27  OpenGLCompatibleDC(SalGraphics &rGraphics, int x, int y, int width, int height);
28 
29  virtual std::unique_ptr<Texture> getAsMaskTexture() const override;
30  // caller must delete
32 
34  bool copyToTexture(Texture& aTexture) const;
35 
36  struct Texture;
37 };
38 
40 {
42  virtual bool isValid() const { return !!texture; }
43  virtual int GetWidth() const { return texture.GetWidth(); }
44  virtual int GetHeight() const { return texture.GetHeight(); }
45 };
46 
48 {
49  friend class WinLayout;
50 private:
52 
54  int nX, int nY, TextureCombo& rCombo);
55 
56 public:
59 
60 protected:
62 
63  bool RenderTextureCombo(TextureCombo const & rCombo, int nX, int nY);
64 
65 public:
66  virtual void Init() override;
67  virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override;
68 
69  virtual bool UseTextDraw() const override { return true; }
70  virtual void PreDrawText() override;
71  virtual void PostDrawText() override;
72  virtual void DrawTextMask( CompatibleDC::Texture* rTexture, Color nMaskColor, const SalTwoRect& rPosAry ) override;
74  virtual void DeferredTextDraw(const CompatibleDC::Texture* pTexture, Color nMaskColor, const SalTwoRect& rPosAry) override;
75 
76  virtual bool UseRenderNativeControl() const override { return true; }
77  virtual bool TryRenderCachedNativeControl(ControlCacheKey const & rControlCacheKey, int nX, int nY) override;
78  virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack,
79  int nX, int nY , ControlCacheKey& aControlCacheKey) override;
80 
81 };
82 
83 typedef std::pair<ControlCacheKey, std::unique_ptr<TextureCombo>> OpenGLControlCachePair;
85 
88 
90 
91 public:
92  static OpenGLControlCacheType & get();
93 };
94 
95 #endif
96 
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Interface used to share logic on sizing between SalVirtualDevices and SalFrames.
Definition: salgeom.hxx:62
SalGeometryProvider * mpProvider
Pointer to the SalFrame or SalVirtualDevice.
void DrawMask(OpenGLTexture &rTexture, Color nMaskColor, const SalTwoRect &rPosAry)
virtual bool RenderAndCacheNativeControl(CompatibleDC &rWhite, CompatibleDC &rBlack, int nX, int nY, ControlCacheKey &aControlCacheKey) override
virtual void Init() override
float x
int GetWidth() const
bool RenderCompatibleDC(OpenGLCompatibleDC &rWhite, OpenGLCompatibleDC &rBlack, int nX, int nY, TextureCombo &rCombo)
OpenGLCompatibleDC(SalGraphics &rGraphics, int x, int y, int width, int height)
virtual void PostDrawText() override
float y
virtual rtl::Reference< OpenGLContext > CreateWinContext() override
create a new context for rendering to the underlying window
virtual std::unique_ptr< Texture > getAsMaskTexture() const override
Obtain the texture in format for WinSalGraphicsImplBase::DrawTextMask().
OpenGLTexture * getOpenGLTexture() const
virtual bool isValid() const
bool copyToTexture(Texture &aTexture) const
Copy bitmap data to the texture. Texture must be initialized and the correct size to hold the bitmap...
OpenGLControlCacheType cache
virtual int GetHeight() const
o3tl::lru_map< ControlCacheKey, std::unique_ptr< TextureCombo >, ControlCacheHashFunction > OpenGLControlCacheType
virtual void PreDrawText() override
virtual void copyBits(const SalTwoRect &rPosAry, SalGraphics *pSrcGraphics) override
bool RenderTextureCombo(TextureCombo const &rCombo, int nX, int nY)
virtual bool UseRenderNativeControl() const override
std::pair< ControlCacheKey, std::unique_ptr< TextureCombo > > OpenGLControlCachePair
int GetHeight() const
virtual bool TryRenderCachedNativeControl(ControlCacheKey const &rControlCacheKey, int nX, int nY) override
virtual bool UseTextDraw() const override
WinOpenGLSalGraphicsImpl(WinSalGraphics &rGraphics, SalGeometryProvider *mpProvider)
virtual void DeferredTextDraw(const CompatibleDC::Texture *pTexture, Color nMaskColor, const SalTwoRect &rPosAry) override
virtual void DrawTextMask(CompatibleDC::Texture *rTexture, Color nMaskColor, const SalTwoRect &rPosAry) override
Class that creates (and destroys) a compatible Device Context.
Definition: win/salgdi.h:100