LCOV - code coverage report
Current view: top level - canvas/source/opengl - ogl_canvashelper.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 3 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_CANVASHELPER_HXX
      11             : #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_CANVASHELPER_HXX
      12             : 
      13             : #include <com/sun/star/rendering/XCanvas.hpp>
      14             : 
      15             : #include <basegfx/vector/b2isize.hxx>
      16             : #include <basegfx/vector/b2dsize.hxx>
      17             : 
      18             : #include <o3tl/cow_wrapper.hxx>
      19             : #include <vector>
      20             : 
      21             : namespace oglcanvas
      22             : {
      23             :     class SpriteDeviceHelper;
      24             : 
      25             :     /** Helper class for basic canvas functionality. */
      26             :     class CanvasHelper
      27             :     {
      28             :     public:
      29             :         CanvasHelper();
      30             : 
      31             :         // outline because of incomplete type Action
      32             :         ~CanvasHelper();
      33             :         CanvasHelper& operator=( const CanvasHelper& );
      34             : 
      35             :         /// Release all references
      36             :         void disposing();
      37             : 
      38             :         /** Initialize canvas helper
      39             : 
      40             :             This method late-initializes the canvas helper, providing
      41             :             it with the necessary device and output objects. Note that
      42             :             the CanvasHelper does <em>not</em> take ownership of the
      43             :             passed rDevice reference, nor does it perform any
      44             :             reference counting. Thus, to prevent the reference counted
      45             :             SpriteCanvas object from deletion, the user of this class
      46             :             is responsible for holding ref-counted references itself!
      47             : 
      48             :             @param rDevice
      49             :             Reference device this canvas is associated with
      50             : 
      51             :          */
      52             :         void init( ::com::sun::star::rendering::XGraphicDevice& rDevice,
      53             :                    SpriteDeviceHelper& rDeviceHelper );
      54             : 
      55             :         // CanvasHelper functionality
      56             :         // ==========================
      57             : 
      58             :         // XCanvas (only providing, not implementing the
      59             :         // interface. Also note subtle method parameter differences)
      60             :         void clear();
      61             :         void drawPoint( const ::com::sun::star::rendering::XCanvas*     pCanvas,
      62             :                         const ::com::sun::star::geometry::RealPoint2D&  aPoint,
      63             :                         const ::com::sun::star::rendering::ViewState&   viewState,
      64             :                         const ::com::sun::star::rendering::RenderState& renderState );
      65             :         void drawLine( const ::com::sun::star::rendering::XCanvas*      pCanvas,
      66             :                        const ::com::sun::star::geometry::RealPoint2D&   aStartPoint,
      67             :                        const ::com::sun::star::geometry::RealPoint2D&   aEndPoint,
      68             :                        const ::com::sun::star::rendering::ViewState&    viewState,
      69             :                        const ::com::sun::star::rendering::RenderState&  renderState );
      70             :         void drawBezier( const ::com::sun::star::rendering::XCanvas*            pCanvas,
      71             :                          const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
      72             :                          const ::com::sun::star::geometry::RealPoint2D&         aEndPoint,
      73             :                          const ::com::sun::star::rendering::ViewState&          viewState,
      74             :                          const ::com::sun::star::rendering::RenderState&        renderState );
      75             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
      76             :             drawPolyPolygon( const ::com::sun::star::rendering::XCanvas*            pCanvas,
      77             :                              const ::com::sun::star::uno::Reference<
      78             :                                     ::com::sun::star::rendering::XPolyPolygon2D >&  xPolyPolygon,
      79             :                              const ::com::sun::star::rendering::ViewState&          viewState,
      80             :                              const ::com::sun::star::rendering::RenderState&        renderState );
      81             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
      82             :             strokePolyPolygon( const ::com::sun::star::rendering::XCanvas*          pCanvas,
      83             :                                const ::com::sun::star::uno::Reference<
      84             :                                     ::com::sun::star::rendering::XPolyPolygon2D >&  xPolyPolygon,
      85             :                                const ::com::sun::star::rendering::ViewState&        viewState,
      86             :                                const ::com::sun::star::rendering::RenderState&      renderState,
      87             :                                const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
      88             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
      89             :             strokeTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas*          pCanvas,
      90             :                                        const ::com::sun::star::uno::Reference<
      91             :                                             ::com::sun::star::rendering::XPolyPolygon2D >&  xPolyPolygon,
      92             :                                        const ::com::sun::star::rendering::ViewState&        viewState,
      93             :                                        const ::com::sun::star::rendering::RenderState&      renderState,
      94             :                                        const ::com::sun::star::uno::Sequence<
      95             :                                             ::com::sun::star::rendering::Texture >&         textures,
      96             :                                        const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
      97             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
      98             :             strokeTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas*             pCanvas,
      99             :                                             const ::com::sun::star::uno::Reference<
     100             :                                                     ::com::sun::star::rendering::XPolyPolygon2D >&  xPolyPolygon,
     101             :                                             const ::com::sun::star::rendering::ViewState&           viewState,
     102             :                                             const ::com::sun::star::rendering::RenderState&         renderState,
     103             :                                             const ::com::sun::star::uno::Sequence<
     104             :                                                     ::com::sun::star::rendering::Texture >&         textures,
     105             :                                             const ::com::sun::star::uno::Reference<
     106             :                                                     ::com::sun::star::geometry::XMapping2D >&       xMapping,
     107             :                                             const ::com::sun::star::rendering::StrokeAttributes&    strokeAttributes );
     108             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >
     109             :             queryStrokeShapes( const ::com::sun::star::rendering::XCanvas*          pCanvas,
     110             :                                const ::com::sun::star::uno::Reference<
     111             :                                     ::com::sun::star::rendering::XPolyPolygon2D >&  xPolyPolygon,
     112             :                                const ::com::sun::star::rendering::ViewState&        viewState,
     113             :                                const ::com::sun::star::rendering::RenderState&      renderState,
     114             :                                const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
     115             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
     116             :             fillPolyPolygon( const ::com::sun::star::rendering::XCanvas*            pCanvas,
     117             :                              const ::com::sun::star::uno::Reference<
     118             :                                     ::com::sun::star::rendering::XPolyPolygon2D >&  xPolyPolygon,
     119             :                              const ::com::sun::star::rendering::ViewState&          viewState,
     120             :                              const ::com::sun::star::rendering::RenderState&        renderState );
     121             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
     122             :             fillTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas*            pCanvas,
     123             :                                      const ::com::sun::star::uno::Reference<
     124             :                                             ::com::sun::star::rendering::XPolyPolygon2D >&  xPolyPolygon,
     125             :                                      const ::com::sun::star::rendering::ViewState&          viewState,
     126             :                                      const ::com::sun::star::rendering::RenderState&        renderState,
     127             :                                      const ::com::sun::star::uno::Sequence<
     128             :                                             ::com::sun::star::rendering::Texture >&         textures );
     129             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
     130             :             fillTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas*           pCanvas,
     131             :                                           const ::com::sun::star::uno::Reference<
     132             :                                                 ::com::sun::star::rendering::XPolyPolygon2D >&  xPolyPolygon,
     133             :                                           const ::com::sun::star::rendering::ViewState&         viewState,
     134             :                                           const ::com::sun::star::rendering::RenderState&       renderState,
     135             :                                           const ::com::sun::star::uno::Sequence<
     136             :                                                 ::com::sun::star::rendering::Texture >&         textures,
     137             :                                           const ::com::sun::star::uno::Reference<
     138             :                                                 ::com::sun::star::geometry::XMapping2D >&       xMapping );
     139             : 
     140             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL
     141             :             createFont( const ::com::sun::star::rendering::XCanvas*             pCanvas,
     142             :                         const ::com::sun::star::rendering::FontRequest&         fontRequest,
     143             :                         const ::com::sun::star::uno::Sequence<
     144             :                                 ::com::sun::star::beans::PropertyValue >&       extraFontProperties,
     145             :                         const ::com::sun::star::geometry::Matrix2D&             fontMatrix );
     146             : 
     147             :         ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo >
     148             :             queryAvailableFonts( const ::com::sun::star::rendering::XCanvas*        pCanvas,
     149             :                                  const ::com::sun::star::rendering::FontInfo&       aFilter,
     150             :                                  const ::com::sun::star::uno::Sequence<
     151             :                                         ::com::sun::star::beans::PropertyValue >&   aFontProperties );
     152             : 
     153             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
     154             :             drawText( const ::com::sun::star::rendering::XCanvas*           pCanvas,
     155             :                       const ::com::sun::star::rendering::StringContext&     text,
     156             :                       const ::com::sun::star::uno::Reference<
     157             :                             ::com::sun::star::rendering::XCanvasFont >&     xFont,
     158             :                       const ::com::sun::star::rendering::ViewState&         viewState,
     159             :                       const ::com::sun::star::rendering::RenderState&       renderState,
     160             :                       sal_Int8                                              textDirection );
     161             : 
     162             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
     163             :             drawTextLayout( const ::com::sun::star::rendering::XCanvas*     pCanvas,
     164             :                             const ::com::sun::star::uno::Reference<
     165             :                                 ::com::sun::star::rendering::XTextLayout >& layoutetText,
     166             :                             const ::com::sun::star::rendering::ViewState&   viewState,
     167             :                             const ::com::sun::star::rendering::RenderState& renderState );
     168             : 
     169             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
     170             :             drawBitmap( const ::com::sun::star::rendering::XCanvas*     pCanvas,
     171             :                         const ::com::sun::star::uno::Reference<
     172             :                                 ::com::sun::star::rendering::XBitmap >& xBitmap,
     173             :                         const ::com::sun::star::rendering::ViewState&   viewState,
     174             :                         const ::com::sun::star::rendering::RenderState& renderState );
     175             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
     176             :             drawBitmapModulated( const ::com::sun::star::rendering::XCanvas*        pCanvas,
     177             :                                  const ::com::sun::star::uno::Reference<
     178             :                                         ::com::sun::star::rendering::XBitmap >&     xBitmap,
     179             :                                  const ::com::sun::star::rendering::ViewState&      viewState,
     180             :                                  const ::com::sun::star::rendering::RenderState&    renderState );
     181             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >
     182             :             getDevice();
     183             : 
     184             :         // Flush drawing queue to screen
     185             :         void                    flush() const;
     186             : 
     187             :         /** Called from XCanvas base classes, to notify that content
     188             :             is _about_ to change
     189             :         */
     190           0 :         void modifying() {}
     191             : 
     192             :         /** Write out recorded actions
     193             :          */
     194             :         bool renderRecordedActions() const;
     195             : 
     196             :         /** Retrieve number of recorded actions
     197             :          */
     198             :         size_t getRecordedActionCount() const;
     199             : 
     200           0 :         SpriteDeviceHelper* getDeviceHelper() const { return mpDeviceHelper; }
     201           0 :         ::com::sun::star::rendering::XGraphicDevice* getDevice() const { return mpDevice; }
     202             : 
     203             :         struct Action;
     204             :         typedef o3tl::cow_wrapper< std::vector<Action>,
     205             :                                    o3tl::ThreadSafeRefCountingPolicy > RecordVectorT;
     206             : 
     207             :     private:
     208             :         // declared, but not defined
     209             :         CanvasHelper( const CanvasHelper& );
     210             : 
     211             :         void setupGraphicsState( Action&                                         o_action,
     212             :                                  const ::com::sun::star::rendering::ViewState&   viewState,
     213             :                                  const ::com::sun::star::rendering::RenderState& renderState );
     214             : 
     215             :         /** Phyical output device
     216             : 
     217             :             Deliberately not a refcounted reference, because of
     218             :             potential circular references for spritecanvas.
     219             :          */
     220             :         ::com::sun::star::rendering::XGraphicDevice* mpDevice;
     221             : 
     222             :         /** Internal helper - used for a few global GL objects,
     223             :             e.g. shader programs; and caches
     224             :          */
     225             :         SpriteDeviceHelper*                          mpDeviceHelper;
     226             : 
     227             :         /** Ptr to array of recorded render calls
     228             : 
     229             :             Gets shared copy-on-write, when this CanvasHelper is
     230             :             copied (used e.g. for CanvasBitmap)
     231             :          */
     232             :         RecordVectorT                                mpRecordedActions;
     233             :     };
     234             : }
     235             : 
     236             : #endif
     237             : 
     238             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10