LCOV - code coverage report
Current view: top level - drawinglayer/source/primitive2d - shadowprimitive2d.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 18 24 75.0 %
Date: 2015-06-13 12:38:46 Functions: 4 5 80.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 <drawinglayer/primitive2d/shadowprimitive2d.hxx>
      21             : #include <basegfx/color/bcolormodifier.hxx>
      22             : #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
      23             : #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
      24             : #include <basegfx/tools/canvastools.hxx>
      25             : #include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
      26             : #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
      27             : #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
      28             : 
      29             : 
      30             : 
      31             : using namespace com::sun::star;
      32             : 
      33             : 
      34             : 
      35             : namespace drawinglayer
      36             : {
      37             :     namespace primitive2d
      38             :     {
      39         672 :         ShadowPrimitive2D::ShadowPrimitive2D(
      40             :             const basegfx::B2DHomMatrix& rShadowTransform,
      41             :             const basegfx::BColor& rShadowColor,
      42             :             const Primitive2DSequence& rChildren)
      43             :         :   GroupPrimitive2D(rChildren),
      44             :             maShadowTransform(rShadowTransform),
      45         672 :             maShadowColor(rShadowColor)
      46             :         {
      47         672 :         }
      48             : 
      49           0 :         bool ShadowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
      50             :         {
      51           0 :             if(BasePrimitive2D::operator==(rPrimitive))
      52             :             {
      53           0 :                 const ShadowPrimitive2D& rCompare = static_cast< const ShadowPrimitive2D& >(rPrimitive);
      54             : 
      55           0 :                 return (getShadowTransform() == rCompare.getShadowTransform()
      56           0 :                     && getShadowColor() == rCompare.getShadowColor());
      57             :             }
      58             : 
      59           0 :             return false;
      60             :         }
      61             : 
      62        2555 :         basegfx::B2DRange ShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
      63             :         {
      64        2555 :             basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation));
      65        2555 :             aRetval.transform(getShadowTransform());
      66        2555 :             return aRetval;
      67             :         }
      68             : 
      69          44 :         Primitive2DSequence ShadowPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
      70             :         {
      71          44 :             Primitive2DSequence aRetval;
      72             : 
      73          44 :             if(getChildren().hasElements())
      74             :             {
      75             :                 // create a modifiedColorPrimitive containing the shadow color and the content
      76             :                 const basegfx::BColorModifierSharedPtr aBColorModifier(
      77             :                     new basegfx::BColorModifier_replace(
      78          44 :                         getShadowColor()));
      79             :                 const Primitive2DReference xRefA(
      80             :                     new ModifiedColorPrimitive2D(
      81          44 :                         getChildren(),
      82          88 :                         aBColorModifier));
      83          88 :                 const Primitive2DSequence aSequenceB(&xRefA, 1L);
      84             : 
      85             :                 // build transformed primitiveVector with shadow offset and add to target
      86          88 :                 const Primitive2DReference xRefB(new TransformPrimitive2D(getShadowTransform(), aSequenceB));
      87          88 :                 aRetval = Primitive2DSequence(&xRefB, 1L);
      88             :             }
      89             : 
      90          44 :             return aRetval;
      91             :         }
      92             : 
      93             :         // provide unique ID
      94          51 :         ImplPrimitive2DIDBlock(ShadowPrimitive2D, PRIMITIVE2D_ID_SHADOWPRIMITIVE2D)
      95             : 
      96             :     } // end of namespace primitive2d
      97             : } // end of namespace drawinglayer
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11