LCOV - code coverage report
Current view: top level - canvas/source/opengl - ogl_spritedevicehelper.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      13             : #include <rtl/ref.hxx>
      14             : #include <canvas/elapsedtime.hxx>
      15             : #include <com/sun/star/rendering/XGraphicDevice.hpp>
      16             : #include <boost/utility.hpp>
      17             : #include <boost/shared_ptr.hpp>
      18             : 
      19             : #include "ogl_buffercontext.hxx"
      20             : 
      21             : #include <set>
      22             : 
      23             : 
      24             : class Window;
      25             : class SystemChildWindow;
      26             : namespace basegfx{ class B2IVector; class B2DHomMatrix; }
      27             : namespace com { namespace sun { namespace star {
      28             :     namespace awt { struct Rectangle; }
      29             :     namespace geometry { struct AffineMatrix2D; }
      30             : }}}
      31             : 
      32             : namespace oglcanvas
      33             : {
      34             :     class TextureCache;
      35             :     class SpriteCanvas;
      36             :     class CanvasCustomSprite;
      37             :     class CanvasHelper;
      38             : 
      39           0 :     class SpriteDeviceHelper : private ::boost::noncopyable
      40             :     {
      41             :     public:
      42             :         SpriteDeviceHelper();
      43             : 
      44             :         void init( Window&                                 rWindow,
      45             :                    SpriteCanvas&                           rSpriteCanvas,
      46             :                    const ::com::sun::star::awt::Rectangle& rViewArea );
      47             : 
      48             :         /// Dispose all internal references
      49             :         void disposing();
      50             : 
      51             :         // XWindowGraphicDevice
      52             :         ::com::sun::star::geometry::RealSize2D getPhysicalResolution();
      53             :         ::com::sun::star::geometry::RealSize2D getPhysicalSize();
      54             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon(
      55             :             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >&                               rDevice,
      56             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points );
      57             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon(
      58             :             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >&                                       rDevice,
      59             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points );
      60             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap(
      61             :             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >&  rDevice,
      62             :             const ::com::sun::star::geometry::IntegerSize2D&                                        size );
      63             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap(
      64             :             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >&  rDevice,
      65             :             const ::com::sun::star::geometry::IntegerSize2D&                                        size );
      66             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap(
      67             :             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >&  rDevice,
      68             :             const ::com::sun::star::geometry::IntegerSize2D&                                        size );
      69             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap(
      70             :             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >&  rDevice,
      71             :             const ::com::sun::star::geometry::IntegerSize2D&                                        size );
      72             : 
      73             :         sal_Bool hasFullScreenMode(  );
      74             :         sal_Bool enterFullScreenMode( sal_Bool bEnter );
      75             : 
      76             :         ::sal_Int32 createBuffers( ::sal_Int32 nBuffers );
      77             :         void        destroyBuffers(  );
      78             :         sal_Bool  showBuffer( bool bIsVisible, sal_Bool bUpdateAll );
      79             :         sal_Bool  switchBuffer( bool bIsVisible, sal_Bool bUpdateAll );
      80             : 
      81             :         ::com::sun::star::uno::Any isAccelerated() const;
      82             :         ::com::sun::star::uno::Any getDeviceHandle() const;
      83             :         ::com::sun::star::uno::Any getSurfaceHandle() const;
      84             :         ::com::sun::star::uno::Reference<
      85             :             ::com::sun::star::rendering::XColorSpace > getColorSpace() const;
      86             : 
      87             :         void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds );
      88             : 
      89             :         /** called when DumpScreenContent property is enabled on
      90             :             XGraphicDevice, and writes out bitmaps of current screen.
      91             :          */
      92             :         void dumpScreenContent() const;
      93             : 
      94             :         void show( const ::rtl::Reference< CanvasCustomSprite >& );
      95             :         void hide( const ::rtl::Reference< CanvasCustomSprite >& );
      96             : 
      97             :         /// enable linear gradient shader "texture" with given parameters
      98             :         void useLinearGradientShader( const ::com::sun::star::rendering::ARGBColor*    pColors,
      99             :                                       const ::com::sun::star::uno::Sequence< double >& rStops,
     100             :                                       const ::basegfx::B2DHomMatrix&                   rTexTransform );
     101             :         /// enable radial gradient shader "texture" with given parameters
     102             :         void useRadialGradientShader( const ::com::sun::star::rendering::ARGBColor*    pColors,
     103             :                                       const ::com::sun::star::uno::Sequence< double >& rStops,
     104             :                                       const ::basegfx::B2DHomMatrix&                   rTexTransform );
     105             :         /// enable rectangular gradient shader "texture" with given parameters
     106             :         void useRectangularGradientShader( const ::com::sun::star::rendering::ARGBColor*    pColors,
     107             :                                            const ::com::sun::star::uno::Sequence< double >& rStops,
     108             :                                            const ::basegfx::B2DHomMatrix&                   rTexTransform );
     109             : 
     110             :         /// create a pbuffer context (for rendering into background surface)
     111             :         IBufferContextSharedPtr createBufferContext(const ::basegfx::B2IVector& rSize) const;
     112             : 
     113             :         /// Get instance of internal texture cache
     114             :         TextureCache& getTextureCache() const;
     115             : 
     116             : 
     117             : 
     118             :         // nobody except IBufferContext implementations are supposed
     119             :         // to use this
     120             :         bool activatePBufferContext(const ::basegfx::B2IVector& rSize,
     121             :                                     unsigned int                PBuffer) const;
     122             :         bool activateWindowContext() const;
     123             :         bool updatePBufferTexture( const ::basegfx::B2IVector&,
     124             :                                    unsigned int ) const;
     125             : 
     126             :     private:
     127             :         void resize( const ::basegfx::B2IVector& rNewSize );
     128             : 
     129             :         void compileShader(unsigned int& o_rShaderHandle,
     130             :                            unsigned int  eShaderType,
     131             :                            const char*   pShaderSourceCode);
     132             :         void linkShaders(unsigned int& o_rProgramHandle,
     133             :                          unsigned int  nVertexProgramId,
     134             :                          unsigned int  nFragmentProgramId);
     135             : 
     136             :         /** Phyical output device
     137             : 
     138             :             Deliberately not a refcounted reference, because of
     139             :             potential circular references for canvas. Needed to
     140             :             create bitmaps
     141             :          */
     142             :         com::sun::star::rendering::XGraphicDevice*         mpDevice;
     143             : 
     144             :         /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
     145             :         SpriteCanvas*                                      mpSpriteCanvas;
     146             : 
     147             :         std::set< ::rtl::Reference< CanvasCustomSprite > > maActiveSprites;
     148             : 
     149             :         /// For the frame counter timings
     150             :         ::canvas::tools::ElapsedTime                       maLastUpdate;
     151             : 
     152             :         boost::shared_ptr<SystemChildWindow>               mpChildWindow;
     153             :         void*                                              mpDisplay;
     154             :         void*                                              mpGLContext;
     155             :         void*                                              mpGLPBufContext;
     156             :         void*                                              mpFBConfig;
     157             : 
     158             :         boost::shared_ptr<TextureCache>                    mpTextureCache;
     159             : 
     160             :         unsigned int                                       mnDummyVertexProgram;
     161             : 
     162             :         unsigned int                                       mnLinearTwoColorGradientFragmentProgram;
     163             :         unsigned int                                       mnLinearMultiColorGradientFragmentProgram;
     164             :         unsigned int                                       mnRadialTwoColorGradientFragmentProgram;
     165             :         unsigned int                                       mnRadialMultiColorGradientFragmentProgram;
     166             :         unsigned int                                       mnRectangularTwoColorGradientFragmentProgram;
     167             :         unsigned int                                       mnRectangularMultiColorGradientFragmentProgram;
     168             :         unsigned int                                       mnLinearTwoColorGradientProgram;
     169             :         unsigned int                                       mnLinearMultiColorGradientProgram;
     170             :         unsigned int                                       mnRadialTwoColorGradientProgram;
     171             :         unsigned int                                       mnRadialMultiColorGradientProgram;
     172             :         unsigned int                                       mnRectangularTwoColorGradientProgram;
     173             :         unsigned int                                       mnRectangularMultiColorGradientProgram;
     174             :     };
     175             : }
     176             : 
     177             : #endif
     178             : 
     179             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10