LCOV - code coverage report
Current view: top level - cppcanvas/source/mtfrenderer - cachedprimitivebase.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 15 0.0 %
Date: 2014-04-14 Functions: 0 2 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             :  * 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             : 
      21             : 
      22             : #include <com/sun/star/rendering/RepaintResult.hpp>
      23             : 
      24             : #include <basegfx/matrix/b2dhommatrix.hxx>
      25             : #include <canvas/canvastools.hxx>
      26             : #include <cppcanvas/canvas.hxx>
      27             : 
      28             : #include "cachedprimitivebase.hxx"
      29             : 
      30             : using namespace ::com::sun::star;
      31             : 
      32             : namespace cppcanvas
      33             : {
      34             :     namespace internal
      35             :     {
      36           0 :         CachedPrimitiveBase::CachedPrimitiveBase( const CanvasSharedPtr& rCanvas,
      37             :                                                   bool                   bOnlyRedrawWithSameTransform ) :
      38             :             mpCanvas( rCanvas ),
      39             :             mxCachedPrimitive(),
      40             :             maLastTransformation(),
      41           0 :             mbOnlyRedrawWithSameTransform( bOnlyRedrawWithSameTransform )
      42             :         {
      43             :             // TODO(F2): also store last view transform, and refuse to
      44             :             // redraw if changed.
      45           0 :         }
      46             : 
      47           0 :         bool CachedPrimitiveBase::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
      48             :         {
      49             :             SAL_INFO( "cppcanvas.emf", "::cppcanvas::internal::CachedPrimitiveBase::render()" );
      50             :             SAL_INFO( "cppcanvas.emf", "::cppcanvas::internal::CachedPrimitiveBase: 0x" << std::hex << this );
      51             : 
      52           0 :             const rendering::ViewState& rViewState( mpCanvas->getViewState() );
      53           0 :             ::basegfx::B2DHomMatrix     aTotalTransform;
      54             : 
      55             :             ::canvas::tools::getViewStateTransform( aTotalTransform,
      56           0 :                                                     rViewState );
      57           0 :             aTotalTransform *= rTransformation;
      58             : 
      59             :             // can we use the cached primitive? For that, it must be
      60             :             // present in the first place, and, if
      61             :             // mbOnlyRedrawWithSameTransform is true, the overall
      62             :             // transformation must be the same.
      63           0 :             if( mxCachedPrimitive.is() &&
      64           0 :                 (!mbOnlyRedrawWithSameTransform ||
      65           0 :                  maLastTransformation == aTotalTransform) )
      66             :             {
      67           0 :                 if( mxCachedPrimitive->redraw( rViewState ) ==
      68             :                     rendering::RepaintResult::REDRAWN )
      69             :                 {
      70             :                     // cached repaint succeeded, done.
      71           0 :                     return true;
      72             :                 }
      73             :             }
      74             : 
      75           0 :             maLastTransformation = aTotalTransform;
      76             : 
      77             :             // delegate rendering to derived classes
      78             :             return renderPrimitive( mxCachedPrimitive,
      79           0 :                                     rTransformation );
      80             :         }
      81             :     }
      82             : }
      83             : 
      84             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10