LCOV - code coverage report
Current view: top level - svtools/source/graphic - grfattr.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 21 48 43.8 %
Date: 2014-04-11 Functions: 3 5 60.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             : 
      21             : #include <tools/vcompat.hxx>
      22             : #include <svtools/grfmgr.hxx>
      23             : 
      24             : 
      25             : // - GraphicAttr -
      26             : 
      27             : 
      28        6967 : GraphicAttr::GraphicAttr() :
      29             :     mfGamma         ( 1.0 ),
      30             :     mnMirrFlags     ( 0 ),
      31             :     mnLeftCrop      ( 0 ),
      32             :     mnTopCrop       ( 0 ),
      33             :     mnRightCrop     ( 0 ),
      34             :     mnBottomCrop    ( 0 ),
      35             :     mnRotate10      ( 0 ),
      36             :     mnContPercent   ( 0 ),
      37             :     mnLumPercent    ( 0 ),
      38             :     mnRPercent      ( 0 ),
      39             :     mnGPercent      ( 0 ),
      40             :     mnBPercent      ( 0 ),
      41             :     mbInvert        ( false ),
      42             :     mcTransparency  ( 0 ),
      43        6967 :     meDrawMode      ( GRAPHICDRAWMODE_STANDARD )
      44             : {
      45        6967 : }
      46             : 
      47             : 
      48             : 
      49       13070 : GraphicAttr::~GraphicAttr()
      50             : {
      51       13070 : }
      52             : 
      53             : 
      54             : 
      55        2514 : bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
      56             : {
      57        5028 :     return( ( mfGamma == rAttr.mfGamma ) &&
      58        5028 :             ( mnMirrFlags == rAttr.mnMirrFlags ) &&
      59        5028 :             ( mnLeftCrop == rAttr.mnLeftCrop ) &&
      60        5028 :             ( mnTopCrop == rAttr.mnTopCrop ) &&
      61        5028 :             ( mnRightCrop == rAttr.mnRightCrop ) &&
      62        5028 :             ( mnBottomCrop == rAttr.mnBottomCrop ) &&
      63        5028 :             ( mnRotate10 == rAttr.mnRotate10 ) &&
      64        5028 :             ( mnContPercent == rAttr.mnContPercent ) &&
      65        5028 :             ( mnLumPercent == rAttr.mnLumPercent ) &&
      66        5028 :             ( mnRPercent == rAttr.mnRPercent ) &&
      67        5028 :             ( mnGPercent == rAttr.mnGPercent ) &&
      68        5028 :             ( mnBPercent == rAttr.mnBPercent ) &&
      69        5028 :             ( mbInvert == rAttr.mbInvert ) &&
      70        7542 :             ( mcTransparency == rAttr.mcTransparency ) &&
      71        5028 :             ( meDrawMode == rAttr.meDrawMode ) );
      72             : }
      73             : 
      74             : 
      75             : 
      76           0 : SvStream& ReadGraphicAttr( SvStream& rIStm, GraphicAttr& rAttr )
      77             : {
      78           0 :     VersionCompat   aCompat( rIStm, STREAM_READ );
      79             :     sal_uInt32      nTmp32;
      80             :     sal_uInt16          nTmp16;
      81             : 
      82           0 :     rIStm.ReadUInt32( nTmp32 ).ReadUInt32( nTmp32 ).ReadDouble( rAttr.mfGamma ).ReadUInt32( rAttr.mnMirrFlags ).ReadUInt16( rAttr.mnRotate10 );
      83           0 :     rIStm.ReadInt16( rAttr.mnContPercent ).ReadInt16( rAttr.mnLumPercent ).ReadInt16( rAttr.mnRPercent ).ReadInt16( rAttr.mnGPercent ).ReadInt16( rAttr.mnBPercent );
      84           0 :     rIStm.ReadCharAsBool( rAttr.mbInvert ).ReadUChar( rAttr.mcTransparency ).ReadUInt16( nTmp16 );
      85           0 :     rAttr.meDrawMode = (GraphicDrawMode) nTmp16;
      86             : 
      87           0 :     if( aCompat.GetVersion() >= 2 )
      88             :     {
      89             :         //#fdo39428 SvStream no longer supports operator>>(long&)
      90           0 :         sal_Int32 nTmpL(0), nTmpT(0), nTmpR(0), nTmpB(0);
      91           0 :         rIStm.ReadInt32( nTmpL ).ReadInt32( nTmpT ).ReadInt32( nTmpR ).ReadInt32( nTmpB );
      92           0 :         rAttr.mnLeftCrop = nTmpL;
      93           0 :         rAttr.mnTopCrop = nTmpT;
      94           0 :         rAttr.mnRightCrop = nTmpR;
      95           0 :         rAttr.mnBottomCrop = nTmpB;
      96             :     }
      97             : 
      98           0 :     return rIStm;
      99             : }
     100             : 
     101             : 
     102             : 
     103           0 : SvStream& WriteGraphicAttr( SvStream& rOStm, const GraphicAttr& rAttr )
     104             : {
     105           0 :     VersionCompat       aCompat( rOStm, STREAM_WRITE, 2 );
     106           0 :     const sal_uInt32    nTmp32 = 0;
     107             : 
     108           0 :     rOStm.WriteUInt32( nTmp32 ).WriteUInt32( nTmp32 );
     109           0 :     rOStm.WriteDouble( rAttr.mfGamma );
     110           0 :     rOStm.WriteUInt32( rAttr.mnMirrFlags ).WriteUInt16( rAttr.mnRotate10 );
     111           0 :     rOStm.WriteInt16( rAttr.mnContPercent ).WriteInt16( rAttr.mnLumPercent ).WriteInt16( rAttr.mnRPercent ).WriteInt16( rAttr.mnGPercent ).WriteInt16( rAttr.mnBPercent );
     112           0 :     rOStm.WriteUChar( rAttr.mbInvert ).WriteUChar( rAttr.mcTransparency ).WriteUInt16( (sal_uInt16) rAttr.meDrawMode );
     113             :     //#fdo39428 SvStream no longer supports operator<<(long)
     114           0 :     rOStm.WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnLeftCrop) )
     115           0 :          .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnTopCrop) )
     116           0 :          .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnRightCrop) )
     117           0 :          .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnBottomCrop) );
     118             : 
     119           0 :     return rOStm;
     120             : }
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10