LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - materialattribute3d.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 46 46 100.0 %
Date: 2015-06-13 12:38:46 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       85703 :         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       28003 :             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       28003 :                 mnSpecularIntensity(nSpecularIntensity)
      44             :             {
      45       28003 :             }
      46             : 
      47         564 :             ImpMaterialAttribute3D(const basegfx::BColor& rColor)
      48             :             :   maColor(rColor),
      49             :                 maSpecular(1.0, 1.0, 1.0),
      50             :                 maEmission(),
      51         564 :                 mnSpecularIntensity(15)
      52             :             {
      53         564 :             }
      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     2963936 :             const basegfx::BColor& getColor() const { return maColor; }
      65       57358 :             const basegfx::BColor& getSpecular() const { return maSpecular; }
      66       57358 :             const basegfx::BColor& getEmission() const { return maEmission; }
      67       57358 :             sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; }
      68             : 
      69       10293 :             bool operator==(const ImpMaterialAttribute3D& rCandidate) const
      70             :             {
      71       10293 :                 return (getColor() == rCandidate.getColor()
      72       10277 :                     && getSpecular() == rCandidate.getSpecular()
      73       10277 :                     && getEmission() == rCandidate.getEmission()
      74       20570 :                     && getSpecularIntensity() == rCandidate.getSpecularIntensity());
      75             :             }
      76             :         };
      77             : 
      78             :         namespace
      79             :         {
      80             :             struct theGlobalDefault :
      81             :                 public rtl::Static< MaterialAttribute3D::ImplType, theGlobalDefault > {};
      82             :         }
      83             : 
      84       28003 :         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       28003 :                 rColor, rSpecular, rEmission, nSpecularIntensity))
      91             :         {
      92       28003 :         }
      93             : 
      94         564 :         MaterialAttribute3D::MaterialAttribute3D(
      95             :             const basegfx::BColor& rColor)
      96         564 :         :   mpMaterialAttribute3D(ImpMaterialAttribute3D(rColor))
      97             :         {
      98         564 :         }
      99             : 
     100           4 :         MaterialAttribute3D::MaterialAttribute3D()
     101           4 :         :   mpMaterialAttribute3D(theGlobalDefault::get())
     102             :         {
     103           4 :         }
     104             : 
     105       47666 :         MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D& rCandidate)
     106       47666 :         :   mpMaterialAttribute3D(rCandidate.mpMaterialAttribute3D)
     107             :         {
     108       47666 :         }
     109             : 
     110       76237 :         MaterialAttribute3D::~MaterialAttribute3D()
     111             :         {
     112       76237 :         }
     113             : 
     114         380 :         MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D& rCandidate)
     115             :         {
     116         380 :             mpMaterialAttribute3D = rCandidate.mpMaterialAttribute3D;
     117         380 :             return *this;
     118             :         }
     119             : 
     120       10316 :         bool MaterialAttribute3D::operator==(const MaterialAttribute3D& rCandidate) const
     121             :         {
     122       10316 :             return rCandidate.mpMaterialAttribute3D == mpMaterialAttribute3D;
     123             :         }
     124             : 
     125     2943350 :         const basegfx::BColor& MaterialAttribute3D::getColor() const
     126             :         {
     127     2943350 :             return mpMaterialAttribute3D->getColor();
     128             :         }
     129             : 
     130       36804 :         const basegfx::BColor& MaterialAttribute3D::getSpecular() const
     131             :         {
     132       36804 :             return mpMaterialAttribute3D->getSpecular();
     133             :         }
     134             : 
     135       36804 :         const basegfx::BColor& MaterialAttribute3D::getEmission() const
     136             :         {
     137       36804 :             return mpMaterialAttribute3D->getEmission();
     138             :         }
     139             : 
     140       36804 :         sal_uInt16 MaterialAttribute3D::getSpecularIntensity() const
     141             :         {
     142       36804 :             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.11