LCOV - code coverage report
Current view: top level - drawinglayer/source/primitive2d - sdrdecompositiontools2d.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 19 21 90.5 %
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/sdrdecompositiontools2d.hxx>
      21             : #include <basegfx/polygon/b2dpolygon.hxx>
      22             : #include <basegfx/polygon/b2dpolygontools.hxx>
      23             : #include <basegfx/matrix/b2dhommatrix.hxx>
      24             : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      25             : #include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
      26             : 
      27             : 
      28             : 
      29             : namespace drawinglayer
      30             : {
      31             :     namespace primitive2d
      32             :     {
      33        1226 :         Primitive2DReference createHiddenGeometryPrimitives2D(
      34             :             bool bFilled,
      35             :             const basegfx::B2DHomMatrix& rMatrix)
      36             :         {
      37        1226 :             const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
      38             : 
      39             :             return createHiddenGeometryPrimitives2D(
      40             :                 bFilled,
      41             :                 basegfx::B2DPolyPolygon(aUnitOutline),
      42        1226 :                 rMatrix);
      43             :         }
      44             : 
      45           0 :         Primitive2DReference createHiddenGeometryPrimitives2D(
      46             :             bool bFilled,
      47             :             const basegfx::B2DPolyPolygon& rPolyPolygon)
      48             :         {
      49             :             return createHiddenGeometryPrimitives2D(
      50             :                 bFilled,
      51             :                 rPolyPolygon,
      52           0 :                 basegfx::B2DHomMatrix());
      53             :         }
      54             : 
      55         440 :         Primitive2DReference createHiddenGeometryPrimitives2D(
      56             :             bool bFilled,
      57             :             const basegfx::B2DRange& rRange)
      58             :         {
      59             :             return createHiddenGeometryPrimitives2D(
      60             :                 bFilled,
      61             :                 rRange,
      62         440 :                 basegfx::B2DHomMatrix());
      63             :         }
      64             : 
      65         440 :         Primitive2DReference createHiddenGeometryPrimitives2D(
      66             :             bool bFilled,
      67             :             const basegfx::B2DRange& rRange,
      68             :             const basegfx::B2DHomMatrix& rMatrix)
      69             :         {
      70         440 :             const basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(rRange));
      71             : 
      72             :             return createHiddenGeometryPrimitives2D(
      73             :                 bFilled,
      74             :                 aOutline,
      75         440 :                 rMatrix);
      76             :         }
      77             : 
      78       39284 :         Primitive2DReference createHiddenGeometryPrimitives2D(
      79             :             bool bFilled,
      80             :             const basegfx::B2DPolyPolygon& rPolyPolygon,
      81             :             const basegfx::B2DHomMatrix& rMatrix)
      82             :         {
      83             :             // create fill or line primitive
      84       39284 :             Primitive2DReference xReference;
      85       78568 :             basegfx::B2DPolyPolygon aScaledOutline(rPolyPolygon);
      86       39284 :             aScaledOutline.transform(rMatrix);
      87             : 
      88       39284 :             if(bFilled)
      89             :             {
      90       43575 :                 xReference = new PolyPolygonColorPrimitive2D(
      91             :                     basegfx::B2DPolyPolygon(aScaledOutline),
      92       29050 :                     basegfx::BColor(0.0, 0.0, 0.0));
      93             :             }
      94             :             else
      95             :             {
      96       24759 :                 const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0);
      97             : 
      98       49518 :                 xReference = new PolyPolygonHairlinePrimitive2D(
      99             :                     aScaledOutline,
     100       49518 :                     aGrayTone);
     101             :             }
     102             : 
     103             :             // create HiddenGeometryPrimitive2D
     104             :             return Primitive2DReference(
     105       78568 :                 new HiddenGeometryPrimitive2D(Primitive2DSequence(&xReference, 1)));
     106             :         }
     107             :     } // end of namespace primitive2d
     108             : } // end of namespace drawinglayer
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11