LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - materialattribute3d.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 46 46 100.0 %
Date: 2014-11-03 Functions: 21 21 100.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/attribute/materialattribute3d.hxx>
      21             : #include <basegfx/color/bcolor.hxx>
      22             : #include <rtl/instance.hxx>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30      138115 :         class ImpMaterialAttribute3D
      31             :         {
      32             :         public:
      33             :             // materialAttribute3D definitions
      34             :             basegfx::BColor                         maColor;                // object color
      35             :             basegfx::BColor                         maSpecular;             // material specular color
      36             :             basegfx::BColor                         maEmission;             // material emissive color
      37             :             sal_uInt16                              mnSpecularIntensity;    // material specular intensity [0..128]
      38             : 
      39       44923 :             ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity)
      40             :             :   maColor(rColor),
      41             :                 maSpecular(rSpecular),
      42             :                 maEmission(rEmission),
      43       44923 :                 mnSpecularIntensity(nSpecularIntensity)
      44             :             {
      45       44923 :             }
      46             : 
      47        1114 :             ImpMaterialAttribute3D(const basegfx::BColor& rColor)
      48             :             :   maColor(rColor),
      49             :                 maSpecular(1.0, 1.0, 1.0),
      50             :                 maEmission(),
      51        1114 :                 mnSpecularIntensity(15)
      52             :             {
      53        1114 :             }
      54             : 
      55           4 :             ImpMaterialAttribute3D()
      56             :             :   maColor(basegfx::BColor()),
      57             :                 maSpecular(basegfx::BColor()),
      58             :                 maEmission(basegfx::BColor()),
      59           4 :                 mnSpecularIntensity(0)
      60             :             {
      61           4 :             }
      62             : 
      63             :             // data read access
      64     3496514 :             const basegfx::BColor& getColor() const { return maColor; }
      65      103470 :             const basegfx::BColor& getSpecular() const { return maSpecular; }
      66      103470 :             const basegfx::BColor& getEmission() const { return maEmission; }
      67      103470 :             sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; }
      68             : 
      69       14320 :             bool operator==(const ImpMaterialAttribute3D& rCandidate) const
      70             :             {
      71       14320 :                 return (getColor() == rCandidate.getColor()
      72       14288 :                     && getSpecular() == rCandidate.getSpecular()
      73       14288 :                     && getEmission() == rCandidate.getEmission()
      74       28608 :                     && getSpecularIntensity() == rCandidate.getSpecularIntensity());
      75             :             }
      76             :         };
      77             : 
      78             :         namespace
      79             :         {
      80             :             struct theGlobalDefault :
      81             :                 public rtl::Static< MaterialAttribute3D::ImplType, theGlobalDefault > {};
      82             :         }
      83             : 
      84       44923 :         MaterialAttribute3D::MaterialAttribute3D(
      85             :             const basegfx::BColor& rColor,
      86             :             const basegfx::BColor& rSpecular,
      87             :             const basegfx::BColor& rEmission,
      88             :             sal_uInt16 nSpecularIntensity)
      89             :         :   mpMaterialAttribute3D(ImpMaterialAttribute3D(
      90       44923 :                 rColor, rSpecular, rEmission, nSpecularIntensity))
      91             :         {
      92       44923 :         }
      93             : 
      94        1114 :         MaterialAttribute3D::MaterialAttribute3D(
      95             :             const basegfx::BColor& rColor)
      96        1114 :         :   mpMaterialAttribute3D(ImpMaterialAttribute3D(rColor))
      97             :         {
      98        1114 :         }
      99             : 
     100           8 :         MaterialAttribute3D::MaterialAttribute3D()
     101           8 :         :   mpMaterialAttribute3D(theGlobalDefault::get())
     102             :         {
     103           8 :         }
     104             : 
     105       70704 :         MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D& rCandidate)
     106       70704 :         :   mpMaterialAttribute3D(rCandidate.mpMaterialAttribute3D)
     107             :         {
     108       70704 :         }
     109             : 
     110      116749 :         MaterialAttribute3D::~MaterialAttribute3D()
     111             :         {
     112      116749 :         }
     113             : 
     114         112 :         MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D& rCandidate)
     115             :         {
     116         112 :             mpMaterialAttribute3D = rCandidate.mpMaterialAttribute3D;
     117         112 :             return *this;
     118             :         }
     119             : 
     120       14366 :         bool MaterialAttribute3D::operator==(const MaterialAttribute3D& rCandidate) const
     121             :         {
     122       14366 :             return rCandidate.mpMaterialAttribute3D == mpMaterialAttribute3D;
     123             :         }
     124             : 
     125     3467874 :         const basegfx::BColor& MaterialAttribute3D::getColor() const
     126             :         {
     127     3467874 :             return mpMaterialAttribute3D->getColor();
     128             :         }
     129             : 
     130       74894 :         const basegfx::BColor& MaterialAttribute3D::getSpecular() const
     131             :         {
     132       74894 :             return mpMaterialAttribute3D->getSpecular();
     133             :         }
     134             : 
     135       74894 :         const basegfx::BColor& MaterialAttribute3D::getEmission() const
     136             :         {
     137       74894 :             return mpMaterialAttribute3D->getEmission();
     138             :         }
     139             : 
     140       74894 :         sal_uInt16 MaterialAttribute3D::getSpecularIntensity() const
     141             :         {
     142       74894 :             return mpMaterialAttribute3D->getSpecularIntensity();
     143             :         }
     144             :     } // end of namespace attribute
     145             : } // end of namespace drawinglayer
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10