LCOV - code coverage report
Current view: top level - cppcanvas/source/mtfrenderer - cachedprimitivebase.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 Functions: 1 2 50.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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_CACHEDPRIMITIVEBASE_HXX
      21             : #define INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_CACHEDPRIMITIVEBASE_HXX
      22             : 
      23             : #include <com/sun/star/uno/Reference.hxx>
      24             : #include <com/sun/star/rendering/XCanvas.hpp>
      25             : 
      26             : #include <cppcanvas/canvas.hxx>
      27             : #include <boost/utility.hpp>
      28             : 
      29             : #include "action.hxx"
      30             : 
      31             : namespace basegfx { class B2DHomMatrix; }
      32             : 
      33             : 
      34             : /* Definition of internal::CachedPrimitiveBase class */
      35             : 
      36             : namespace cppcanvas
      37             : {
      38             :     namespace internal
      39             :     {
      40             :         /** Base class providing cached re-rendering, if XCanvas
      41             :             returns XCachedPrimitive
      42             : 
      43             :             Derive from this class and implement private render()
      44             :             method to perform the actual primitive rendering. Return
      45             :             cached primitive into given reference. Next time this
      46             :             class' public render() method gets called, the cached
      47             :             representation is taken.
      48             :          */
      49             :         class CachedPrimitiveBase : public Action,
      50             :                                     private ::boost::noncopyable
      51             :         {
      52             :         public:
      53             :             /** Constructor
      54             : 
      55             :                 @param rCanvas
      56             :                 Canvas on which this primitive is to appear
      57             : 
      58             :                 @param bOnlyRedrawWithSameTransform
      59             :                 When true, this class only reuses the cached
      60             :                 primitive, if the overall transformation stays the
      61             :                 same. Otherwise, repaints are always performed via the
      62             :                 cached primitive.
      63             :              */
      64             :             CachedPrimitiveBase( const CanvasSharedPtr& rCanvas,
      65             :                                  bool                   bOnlyRedrawWithSameTransform );
      66          12 :             virtual ~CachedPrimitiveBase() {}
      67             : 
      68             :             virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const SAL_OVERRIDE;
      69             : 
      70             :         protected:
      71             :             using Action::render;
      72             : 
      73             :         private:
      74             :             virtual bool renderPrimitive( ::com::sun::star::uno::Reference<
      75             :                                      ::com::sun::star::rendering::XCachedPrimitive >& rCachedPrimitive,
      76             :                                  const ::basegfx::B2DHomMatrix&                       rTransformation ) const = 0;
      77             : 
      78             :             CanvasSharedPtr                                             mpCanvas;
      79             :             mutable ::com::sun::star::uno::Reference<
      80             :                     ::com::sun::star::rendering::XCachedPrimitive >     mxCachedPrimitive;
      81             :             mutable ::basegfx::B2DHomMatrix                             maLastTransformation;
      82             :             const bool                                                  mbOnlyRedrawWithSameTransform;
      83             :         };
      84             :     }
      85             : }
      86             : 
      87             : #endif // INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_CACHEDPRIMITIVEBASE_HXX
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11