LCOV - code coverage report
Current view: top level - drawinglayer/source/primitive3d - textureprimitive3d.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 53 18.9 %
Date: 2012-08-25 Functions: 4 16 25.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 44 2.3 %

           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/primitive3d/textureprimitive3d.hxx>
      21                 :            : #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
      22                 :            : #include <basegfx/color/bcolor.hxx>
      23                 :            : 
      24                 :            : //////////////////////////////////////////////////////////////////////////////
      25                 :            : 
      26                 :            : using namespace com::sun::star;
      27                 :            : 
      28                 :            : //////////////////////////////////////////////////////////////////////////////
      29                 :            : 
      30                 :            : namespace drawinglayer
      31                 :            : {
      32                 :            :     namespace primitive3d
      33                 :            :     {
      34                 :         24 :         TexturePrimitive3D::TexturePrimitive3D(
      35                 :            :             const Primitive3DSequence& rChildren,
      36                 :            :             const basegfx::B2DVector& rTextureSize,
      37                 :            :             bool bModulate, bool bFilter)
      38                 :            :         :   GroupPrimitive3D(rChildren),
      39                 :            :             maTextureSize(rTextureSize),
      40                 :            :             mbModulate(bModulate),
      41                 :         24 :             mbFilter(bFilter)
      42                 :            :         {
      43                 :         24 :         }
      44                 :            : 
      45                 :          0 :         bool TexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
      46                 :            :         {
      47         [ #  # ]:          0 :             if(GroupPrimitive3D::operator==(rPrimitive))
      48                 :            :             {
      49                 :          0 :                 const TexturePrimitive3D& rCompare = (TexturePrimitive3D&)rPrimitive;
      50                 :            : 
      51                 :          0 :                 return (getModulate() == rCompare.getModulate()
      52 [ #  # ][ #  # ]:          0 :                     && getFilter() == rCompare.getFilter());
      53                 :            :             }
      54                 :            : 
      55                 :          0 :             return false;
      56                 :            :         }
      57                 :            :     } // end of namespace primitive3d
      58                 :            : } // end of namespace drawinglayer
      59                 :            : 
      60                 :            : //////////////////////////////////////////////////////////////////////////////
      61                 :            : 
      62                 :            : namespace drawinglayer
      63                 :            : {
      64                 :            :     namespace primitive3d
      65                 :            :     {
      66                 :          0 :         UnifiedTransparenceTexturePrimitive3D::UnifiedTransparenceTexturePrimitive3D(
      67                 :            :             double fTransparence,
      68                 :            :             const Primitive3DSequence& rChildren)
      69                 :            :         :   TexturePrimitive3D(rChildren, basegfx::B2DVector(), false, false),
      70         [ #  # ]:          0 :             mfTransparence(fTransparence)
      71                 :            :         {
      72                 :          0 :         }
      73                 :            : 
      74                 :          0 :         bool UnifiedTransparenceTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
      75                 :            :         {
      76         [ #  # ]:          0 :             if(TexturePrimitive3D::operator==(rPrimitive))
      77                 :            :             {
      78                 :          0 :                 const UnifiedTransparenceTexturePrimitive3D& rCompare = (UnifiedTransparenceTexturePrimitive3D&)rPrimitive;
      79                 :            : 
      80                 :          0 :                 return (getTransparence() == rCompare.getTransparence());
      81                 :            :             }
      82                 :            : 
      83                 :          0 :             return false;
      84                 :            :         }
      85                 :            : 
      86                 :          0 :         basegfx::B3DRange UnifiedTransparenceTexturePrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const
      87                 :            :         {
      88                 :            :             // do not use the fallback to decomposition here since for a correct BoundRect we also
      89                 :            :             // need invisible (1.0 == getTransparence()) geometry; these would be deleted in the decomposition
      90         [ #  # ]:          0 :             return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation);
      91                 :            :         }
      92                 :            : 
      93                 :          0 :         Primitive3DSequence UnifiedTransparenceTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const
      94                 :            :         {
      95         [ #  # ]:          0 :             if(0.0 == getTransparence())
      96                 :            :             {
      97                 :            :                 // no transparence used, so just use content
      98                 :          0 :                 return getChildren();
      99                 :            :             }
     100 [ #  # ][ #  # ]:          0 :             else if(getTransparence() > 0.0 && getTransparence() < 1.0)
                 [ #  # ]
     101                 :            :             {
     102                 :            :                 // create TransparenceTexturePrimitive3D with fixed transparence as replacement
     103                 :          0 :                 const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence());
     104         [ #  # ]:          0 :                 const attribute::FillGradientAttribute aFillGradient(attribute::GRADIENTSTYLE_LINEAR, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1);
     105 [ #  # ][ #  # ]:          0 :                 const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize()));
         [ #  # ][ #  # ]
                 [ #  # ]
     106 [ #  # ][ #  # ]:          0 :                 return Primitive3DSequence(&xRef, 1L);
     107                 :            :             }
     108                 :            :             else
     109                 :            :             {
     110                 :            :                 // completely transparent or invalid definition, add nothing
     111                 :          0 :                 return Primitive3DSequence();
     112                 :            :             }
     113                 :            :         }
     114                 :            : 
     115                 :            :         // provide unique ID
     116                 :          0 :         ImplPrimitrive3DIDBlock(UnifiedTransparenceTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D)
     117                 :            : 
     118                 :            :     } // end of namespace primitive3d
     119                 :            : } // end of namespace drawinglayer
     120                 :            : 
     121                 :            : //////////////////////////////////////////////////////////////////////////////
     122                 :            : 
     123                 :            : namespace drawinglayer
     124                 :            : {
     125                 :            :     namespace primitive3d
     126                 :            :     {
     127                 :         16 :         GradientTexturePrimitive3D::GradientTexturePrimitive3D(
     128                 :            :             const attribute::FillGradientAttribute& rGradient,
     129                 :            :             const Primitive3DSequence& rChildren,
     130                 :            :             const basegfx::B2DVector& rTextureSize,
     131                 :            :             bool bModulate,
     132                 :            :             bool bFilter)
     133                 :            :         :   TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
     134         [ +  - ]:         16 :             maGradient(rGradient)
     135                 :            :         {
     136                 :         16 :         }
     137                 :            : 
     138                 :          0 :         bool GradientTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
     139                 :            :         {
     140         [ #  # ]:          0 :             if(TexturePrimitive3D::operator==(rPrimitive))
     141                 :            :             {
     142                 :          0 :                 const GradientTexturePrimitive3D& rCompare = (GradientTexturePrimitive3D&)rPrimitive;
     143                 :            : 
     144                 :          0 :                 return (getGradient() == rCompare.getGradient());
     145                 :            :             }
     146                 :            : 
     147                 :          0 :             return false;
     148                 :            :         }
     149                 :            : 
     150                 :            :         // provide unique ID
     151                 :          0 :         ImplPrimitrive3DIDBlock(GradientTexturePrimitive3D, PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D)
     152                 :            : 
     153                 :            :     } // end of namespace primitive3d
     154                 :            : } // end of namespace drawinglayer
     155                 :            : 
     156                 :            : //////////////////////////////////////////////////////////////////////////////
     157                 :            : 
     158                 :            : namespace drawinglayer
     159                 :            : {
     160                 :            :     namespace primitive3d
     161                 :            :     {
     162                 :          0 :         BitmapTexturePrimitive3D::BitmapTexturePrimitive3D(
     163                 :            :             const attribute::FillBitmapAttribute& rFillBitmapAttribute,
     164                 :            :             const Primitive3DSequence& rChildren,
     165                 :            :             const basegfx::B2DVector& rTextureSize,
     166                 :            :             bool bModulate, bool bFilter)
     167                 :            :         :   TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
     168         [ #  # ]:          0 :             maFillBitmapAttribute(rFillBitmapAttribute)
     169                 :            :         {
     170                 :          0 :         }
     171                 :            : 
     172                 :          0 :         bool BitmapTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
     173                 :            :         {
     174         [ #  # ]:          0 :             if(TexturePrimitive3D::operator==(rPrimitive))
     175                 :            :             {
     176                 :          0 :                 const BitmapTexturePrimitive3D& rCompare = (BitmapTexturePrimitive3D&)rPrimitive;
     177                 :            : 
     178                 :          0 :                 return (getFillBitmapAttribute() == rCompare.getFillBitmapAttribute());
     179                 :            :             }
     180                 :            : 
     181                 :          0 :             return false;
     182                 :            :         }
     183                 :            : 
     184                 :            :         // provide unique ID
     185                 :          0 :         ImplPrimitrive3DIDBlock(BitmapTexturePrimitive3D, PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D)
     186                 :            : 
     187                 :            :     } // end of namespace primitive3d
     188                 :            : } // end of namespace drawinglayer
     189                 :            : 
     190                 :            : //////////////////////////////////////////////////////////////////////////////
     191                 :            : 
     192                 :            : namespace drawinglayer
     193                 :            : {
     194                 :            :     namespace primitive3d
     195                 :            :     {
     196                 :         16 :         TransparenceTexturePrimitive3D::TransparenceTexturePrimitive3D(
     197                 :            :             const attribute::FillGradientAttribute& rGradient,
     198                 :            :             const Primitive3DSequence& rChildren,
     199                 :            :             const basegfx::B2DVector& rTextureSize)
     200                 :         16 :         :   GradientTexturePrimitive3D(rGradient, rChildren, rTextureSize, false, false)
     201                 :            :         {
     202                 :         16 :         }
     203                 :            : 
     204                 :          0 :         bool TransparenceTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
     205                 :            :         {
     206                 :          0 :             return (GradientTexturePrimitive3D::operator==(rPrimitive));
     207                 :            :         }
     208                 :            : 
     209                 :            :         // provide unique ID
     210                 :         32 :         ImplPrimitrive3DIDBlock(TransparenceTexturePrimitive3D, PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D)
     211                 :            : 
     212                 :            :     } // end of namespace primitive3d
     213                 :            : } // end of namespace drawinglayer
     214                 :            : 
     215                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10