LCOV - code coverage report
Current view: top level - cppcanvas/source/wrapper - implspritecanvas.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 40 0.0 %
Date: 2014-11-03 Functions: 0 15 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             : #include <basegfx/matrix/b2dhommatrix.hxx>
      21             : #include <basegfx/tools/canvastools.hxx>
      22             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      23             : #include <com/sun/star/rendering/InterpolationMode.hpp>
      24             : 
      25             : #include <implspritecanvas.hxx>
      26             : #include <implcustomsprite.hxx>
      27             : 
      28             : 
      29             : using namespace ::com::sun::star;
      30             : 
      31             : namespace cppcanvas
      32             : {
      33             :     namespace internal
      34             :     {
      35           0 :         ImplSpriteCanvas::TransformationArbiter::TransformationArbiter() :
      36           0 :             maTransformation()
      37             :         {
      38           0 :         }
      39             : 
      40           0 :         void ImplSpriteCanvas::TransformationArbiter::setTransformation( const ::basegfx::B2DHomMatrix& rViewTransform )
      41             :         {
      42           0 :             maTransformation = rViewTransform;
      43           0 :         }
      44             : 
      45             : 
      46             : 
      47           0 :         ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) :
      48             :             ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
      49             :                                                              uno::UNO_QUERY) ),
      50             :             mxSpriteCanvas( rCanvas ),
      51           0 :             mpTransformArbiter( new TransformationArbiter() )
      52             :         {
      53             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::ImplSpriteCanvas(): Invalid canvas" );
      54           0 :         }
      55             : 
      56           0 :         ImplSpriteCanvas::ImplSpriteCanvas(const ImplSpriteCanvas& rOrig) :
      57             :             Canvas(),
      58             :             SpriteCanvas(),
      59             :             ImplCanvas( rOrig ),
      60           0 :             mxSpriteCanvas( rOrig.getUNOSpriteCanvas() ),
      61           0 :             mpTransformArbiter( new TransformationArbiter() )
      62             :         {
      63             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::ImplSpriteCanvas( const ImplSpriteCanvas& ): Invalid canvas" );
      64             : 
      65           0 :             mpTransformArbiter->setTransformation( getTransformation() );
      66           0 :         }
      67             : 
      68           0 :         ImplSpriteCanvas::~ImplSpriteCanvas()
      69             :         {
      70           0 :         }
      71             : 
      72           0 :         void ImplSpriteCanvas::setTransformation( const ::basegfx::B2DHomMatrix& rMatrix )
      73             :         {
      74           0 :             mpTransformArbiter->setTransformation( rMatrix );
      75             : 
      76           0 :             ImplCanvas::setTransformation( rMatrix );
      77           0 :         }
      78             : 
      79           0 :         bool ImplSpriteCanvas::updateScreen( bool bUpdateAll ) const
      80             :         {
      81             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::updateScreen(): Invalid canvas" );
      82             : 
      83           0 :             if( !mxSpriteCanvas.is() )
      84           0 :                 return false;
      85             : 
      86           0 :             return mxSpriteCanvas->updateScreen( bUpdateAll );
      87             :         }
      88             : 
      89           0 :         CustomSpriteSharedPtr ImplSpriteCanvas::createCustomSprite( const ::basegfx::B2DSize& rSize ) const
      90             :         {
      91             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::createCustomSprite(): Invalid canvas" );
      92             : 
      93           0 :             if( !mxSpriteCanvas.is() )
      94           0 :                 return CustomSpriteSharedPtr();
      95             : 
      96             :             return CustomSpriteSharedPtr(
      97             :                 new ImplCustomSprite( mxSpriteCanvas,
      98           0 :                                       mxSpriteCanvas->createCustomSprite( ::basegfx::unotools::size2DFromB2DSize(rSize) ),
      99           0 :                                       mpTransformArbiter ) );
     100             :         }
     101             : 
     102           0 :         SpriteSharedPtr ImplSpriteCanvas::createClonedSprite( const SpriteSharedPtr& rSprite ) const
     103             :         {
     104             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::createCustomSprite(): Invalid canvas" );
     105             :             OSL_ENSURE( rSprite.get() != NULL && rSprite->getUNOSprite().is(),
     106             :                         "ImplSpriteCanvas::createCustomSprite(): Invalid sprite" );
     107             : 
     108           0 :             if( !mxSpriteCanvas.is() ||
     109           0 :                 rSprite.get() == NULL ||
     110           0 :                 !rSprite->getUNOSprite().is() )
     111             :             {
     112           0 :                 return SpriteSharedPtr();
     113             :             }
     114             : 
     115             :             return SpriteSharedPtr(
     116             :                 new ImplSprite( mxSpriteCanvas,
     117           0 :                                 mxSpriteCanvas->createClonedSprite( rSprite->getUNOSprite() ),
     118           0 :                                 mpTransformArbiter ) );
     119             :         }
     120             : 
     121           0 :         CanvasSharedPtr ImplSpriteCanvas::clone() const
     122             :         {
     123           0 :             return SpriteCanvasSharedPtr( new ImplSpriteCanvas( *this ) );
     124             :         }
     125             : 
     126           0 :         uno::Reference< rendering::XSpriteCanvas > ImplSpriteCanvas::getUNOSpriteCanvas() const
     127             :         {
     128           0 :             return mxSpriteCanvas;
     129             :         }
     130             : 
     131             :     }
     132             : }
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10