LCOV - code coverage report
Current view: top level - drawinglayer/source/primitive2d - shadowprimitive2d.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 23 73.9 %
Date: 2012-08-25 Functions: 4 5 80.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 14 34 41.2 %

           Branch data     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                 :        338 :         ShadowPrimitive2D::ShadowPrimitive2D(
      40                 :            :             const basegfx::B2DHomMatrix& rShadowTransform,
      41                 :            :             const basegfx::BColor& rShadowColor,
      42                 :            :             const Primitive2DSequence& rChildren)
      43                 :            :         :   GroupPrimitive2D(rChildren),
      44                 :            :             maShadowTransform(rShadowTransform),
      45         [ +  - ]:        338 :             maShadowColor(rShadowColor)
      46                 :            :         {
      47                 :        338 :         }
      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                 :       1390 :         basegfx::B2DRange ShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
      63                 :            :         {
      64                 :       1390 :             basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation));
      65                 :       1390 :             aRetval.transform(getShadowTransform());
      66                 :       1390 :             return aRetval;
      67                 :            :         }
      68                 :            : 
      69                 :          2 :         Primitive2DSequence ShadowPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
      70                 :            :         {
      71                 :          2 :             Primitive2DSequence aRetval;
      72                 :            : 
      73         [ +  - ]:          2 :             if(getChildren().hasElements())
      74                 :            :             {
      75                 :            :                 // create a modifiedColorPrimitive containing the shadow color and the content
      76                 :          2 :                 const basegfx::BColorModifier aBColorModifier(getShadowColor());
      77 [ +  - ][ +  - ]:          2 :                 const Primitive2DReference xRefA(new ModifiedColorPrimitive2D(getChildren(), aBColorModifier));
                 [ +  - ]
      78         [ +  - ]:          2 :                 const Primitive2DSequence aSequenceB(&xRefA, 1L);
      79                 :            : 
      80                 :            :                 // build transformed primitiveVector with shadow offset and add to target
      81 [ +  - ][ +  - ]:          2 :                 const Primitive2DReference xRefB(new TransformPrimitive2D(getShadowTransform(), aSequenceB));
                 [ +  - ]
      82 [ +  - ][ +  - ]:          2 :                 aRetval = Primitive2DSequence(&xRefB, 1L);
         [ +  - ][ +  - ]
                 [ +  - ]
      83                 :            :             }
      84                 :            : 
      85                 :          2 :             return aRetval;
      86                 :            :         }
      87                 :            : 
      88                 :            :         // provide unique ID
      89                 :          2 :         ImplPrimitrive2DIDBlock(ShadowPrimitive2D, PRIMITIVE2D_ID_SHADOWPRIMITIVE2D)
      90                 :            : 
      91                 :            :     } // end of namespace primitive2d
      92                 :            : } // end of namespace drawinglayer
      93                 :            : 
      94                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10