LibreOffice Module canvas (master)  1
ogl_spritedevicehelper.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_CANVAS_SOURCE_OPENGL_OGL_SPRITEDEVICEHELPER_HXX
11 #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_SPRITEDEVICEHELPER_HXX
12 
14 
15 #include <rtl/ref.hxx>
16 #include <canvas/elapsedtime.hxx>
17 #include <com/sun/star/rendering/XGraphicDevice.hpp>
18 
19 #include "ogl_buffercontext.hxx"
20 
21 #include <set>
22 
23 namespace vcl { class Window; }
24 class SystemChildWindow;
25 namespace basegfx{ class B2IVector; class B2DHomMatrix; }
26 namespace com::sun::star {
27  namespace awt { struct Rectangle; }
28  namespace geometry { struct AffineMatrix2D; }
29 }
30 
31 namespace oglcanvas
32 {
33  class TextureCache;
34  class SpriteCanvas;
35  class CanvasCustomSprite;
36  class CanvasHelper;
37 
39  {
40  public:
43 
45  SpriteDeviceHelper(const SpriteDeviceHelper&) = delete;
46  const SpriteDeviceHelper& operator=(const SpriteDeviceHelper&) = delete;
47 
48  void init( vcl::Window& rWindow,
49  SpriteCanvas& rSpriteCanvas,
50  const css::awt::Rectangle& rViewArea );
51 
53  void disposing();
54 
55  // XWindowGraphicDevice
56  css::geometry::RealSize2D getPhysicalResolution();
57  css::geometry::RealSize2D getPhysicalSize();
58  css::uno::Reference< css::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon(
59  const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
60  const css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > >& points );
61  css::uno::Reference< css::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon(
62  const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
63  const css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > >& points );
64  css::uno::Reference< css::rendering::XBitmap > createCompatibleBitmap(
65  const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
66  const css::geometry::IntegerSize2D& size );
67  css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileBitmap(
68  const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
69  const css::geometry::IntegerSize2D& size );
70  css::uno::Reference< css::rendering::XBitmap > createCompatibleAlphaBitmap(
71  const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
72  const css::geometry::IntegerSize2D& size );
73  css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileAlphaBitmap(
74  const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
75  const css::geometry::IntegerSize2D& size );
76 
77  bool showBuffer( bool bIsVisible, bool bUpdateAll );
78  bool switchBuffer( bool bIsVisible, bool bUpdateAll );
79 
80  css::uno::Any isAccelerated() const;
81  css::uno::Any getDeviceHandle() const;
82  css::uno::Any getSurfaceHandle() const;
83  css::uno::Reference<
84  css::rendering::XColorSpace > getColorSpace() const;
85 
86  void notifySizeUpdate( const css::awt::Rectangle& rBounds );
87 
91  void dumpScreenContent() const;
92 
93  void show( const ::rtl::Reference< CanvasCustomSprite >& );
94  void hide( const ::rtl::Reference< CanvasCustomSprite >& );
95 
97  void useLinearGradientShader( const css::rendering::ARGBColor* pColors,
98  const css::uno::Sequence< double >& rStops,
99  const ::basegfx::B2DHomMatrix& rTexTransform );
101  void useRadialGradientShader( const css::rendering::ARGBColor* pColors,
102  const css::uno::Sequence< double >& rStops,
103  const ::basegfx::B2DHomMatrix& rTexTransform );
105  void useRectangularGradientShader( const css::rendering::ARGBColor* pColors,
106  const css::uno::Sequence< double >& rStops,
107  const ::basegfx::B2DHomMatrix& rTexTransform );
108 
110  IBufferContextSharedPtr createBufferContext(const ::basegfx::B2IVector& rSize) const;
111 
113  TextureCache& getTextureCache() const;
114 
115  private:
118 
119  std::set< ::rtl::Reference< CanvasCustomSprite > > maActiveSprites;
120 
123 
124  std::shared_ptr<TextureCache> mpTextureCache;
125 
132 
134  };
135 }
136 
137 #endif
138 
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void disposing()
Dispose all internal references.
void useRadialGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable radial gradient shader "texture" with given parameters
void dumpScreenContent() const
called when DumpScreenContent property is enabled on XGraphicDevice, and writes out bitmaps of curren...
std::shared_ptr< TextureCache > mpTextureCache
css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileAlphaBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
TextureCache & getTextureCache() const
Get instance of internal texture cache.
Calculate elapsed time.
Definition: elapsedtime.hxx:36
const SpriteDeviceHelper & operator=(const SpriteDeviceHelper &)=delete
void useRectangularGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable rectangular gradient shader "texture" with given parameters
exports com.sun.star. awt
css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
exports com.sun.star. geometry
void show(const ::rtl::Reference< CanvasCustomSprite > &)
std::shared_ptr< IBufferContext > IBufferContextSharedPtr
css::geometry::RealSize2D getPhysicalSize()
bool showBuffer(bool bIsVisible, bool bUpdateAll)
::canvas::tools::ElapsedTime maLastUpdate
For the frame counter timings.
IBufferContextSharedPtr createBufferContext(const ::basegfx::B2IVector &rSize) const
create a pbuffer context (for rendering into background surface)
bool switchBuffer(bool bIsVisible, bool bUpdateAll)
css::uno::Reference< css::rendering::XColorSpace > getColorSpace() const
rtl::Reference< OpenGLContext > mxContext
size
css::uno::Reference< css::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > > &points)
void notifySizeUpdate(const css::awt::Rectangle &rBounds)
css::uno::Reference< css::rendering::XBitmap > createCompatibleAlphaBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
void init(vcl::Window &rWindow, SpriteCanvas &rSpriteCanvas, const css::awt::Rectangle &rViewArea)
Product of this component's factory.
css::uno::Reference< css::rendering::XBitmap > createCompatibleBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
void hide(const ::rtl::Reference< CanvasCustomSprite > &)
css::geometry::RealSize2D getPhysicalResolution()
std::set< ::rtl::Reference< CanvasCustomSprite > > maActiveSprites
css::uno::Reference< css::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > > &points)
void useLinearGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable linear gradient shader "texture" with given parameters
SpriteCanvas * mpSpriteCanvas
Pointer to sprite canvas (owner of this helper), needed to create bitmaps.