LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - materialattribute3d.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 46 46 100.0 %
Date: 2014-04-11 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       63864 :         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       20930 :             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       20930 :                 mnSpecularIntensity(nSpecularIntensity)
      44             :             {
      45       20930 :             }
      46             : 
      47         453 :             ImpMaterialAttribute3D(const basegfx::BColor& rColor)
      48             :             :   maColor(rColor),
      49             :                 maSpecular(1.0, 1.0, 1.0),
      50             :                 maEmission(),
      51         453 :                 mnSpecularIntensity(15)
      52             :             {
      53         453 :             }
      54             : 
      55           2 :             ImpMaterialAttribute3D()
      56             :             :   maColor(basegfx::BColor()),
      57             :                 maSpecular(basegfx::BColor()),
      58             :                 maEmission(basegfx::BColor()),
      59           2 :                 mnSpecularIntensity(0)
      60             :             {
      61           2 :             }
      62             : 
      63             :             // data read access
      64      983567 :             const basegfx::BColor& getColor() const { return maColor; }
      65       50314 :             const basegfx::BColor& getSpecular() const { return maSpecular; }
      66       50314 :             const basegfx::BColor& getEmission() const { return maEmission; }
      67       50314 :             sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; }
      68             : 
      69        6512 :             bool operator==(const ImpMaterialAttribute3D& rCandidate) const
      70             :             {
      71        6512 :                 return (getColor() == rCandidate.getColor()
      72        6496 :                     && getSpecular() == rCandidate.getSpecular()
      73        6496 :                     && getEmission() == rCandidate.getEmission()
      74       13008 :                     && getSpecularIntensity() == rCandidate.getSpecularIntensity());
      75             :             }
      76             :         };
      77             : 
      78             :         namespace
      79             :         {
      80             :             struct theGlobalDefault :
      81             :                 public rtl::Static< MaterialAttribute3D::ImplType, theGlobalDefault > {};
      82             :         }
      83             : 
      84       20930 :         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       20930 :                 rColor, rSpecular, rEmission, nSpecularIntensity))
      91             :         {
      92       20930 :         }
      93             : 
      94         453 :         MaterialAttribute3D::MaterialAttribute3D(
      95             :             const basegfx::BColor& rColor)
      96         453 :         :   mpMaterialAttribute3D(ImpMaterialAttribute3D(rColor))
      97             :         {
      98         453 :         }
      99             : 
     100           4 :         MaterialAttribute3D::MaterialAttribute3D()
     101           4 :         :   mpMaterialAttribute3D(theGlobalDefault::get())
     102             :         {
     103           4 :         }
     104             : 
     105       32423 :         MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D& rCandidate)
     106       32423 :         :   mpMaterialAttribute3D(rCandidate.mpMaterialAttribute3D)
     107             :         {
     108       32423 :         }
     109             : 
     110       39265 :         MaterialAttribute3D::~MaterialAttribute3D()
     111             :         {
     112       39265 :         }
     113             : 
     114          92 :         MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D& rCandidate)
     115             :         {
     116          92 :             mpMaterialAttribute3D = rCandidate.mpMaterialAttribute3D;
     117          92 :             return *this;
     118             :         }
     119             : 
     120        6535 :         bool MaterialAttribute3D::operator==(const MaterialAttribute3D& rCandidate) const
     121             :         {
     122        6535 :             return rCandidate.mpMaterialAttribute3D == mpMaterialAttribute3D;
     123             :         }
     124             : 
     125      970543 :         const basegfx::BColor& MaterialAttribute3D::getColor() const
     126             :         {
     127      970543 :             return mpMaterialAttribute3D->getColor();
     128             :         }
     129             : 
     130       37322 :         const basegfx::BColor& MaterialAttribute3D::getSpecular() const
     131             :         {
     132       37322 :             return mpMaterialAttribute3D->getSpecular();
     133             :         }
     134             : 
     135       37322 :         const basegfx::BColor& MaterialAttribute3D::getEmission() const
     136             :         {
     137       37322 :             return mpMaterialAttribute3D->getEmission();
     138             :         }
     139             : 
     140       37322 :         sal_uInt16 MaterialAttribute3D::getSpecularIntensity() const
     141             :         {
     142       37322 :             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