LCOV - code coverage report
Current view: top level - svtools/source/graphic - grfattr.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 21 49 42.9 %
Date: 2015-06-13 12:38:46 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       12977 : GraphicAttr::GraphicAttr() :
      29             :     mfGamma         ( 1.0 ),
      30             :     mnMirrFlags     ( BmpMirrorFlags::NONE ),
      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       12977 :     meDrawMode      ( GRAPHICDRAWMODE_STANDARD )
      44             : {
      45       12977 : }
      46             : 
      47             : 
      48             : 
      49       25061 : GraphicAttr::~GraphicAttr()
      50             : {
      51       25061 : }
      52             : 
      53             : 
      54             : 
      55       10439 : bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
      56             : {
      57       20878 :     return( ( mfGamma == rAttr.mfGamma ) &&
      58       20878 :             ( mnMirrFlags == rAttr.mnMirrFlags ) &&
      59       20878 :             ( mnLeftCrop == rAttr.mnLeftCrop ) &&
      60       20878 :             ( mnTopCrop == rAttr.mnTopCrop ) &&
      61       20878 :             ( mnRightCrop == rAttr.mnRightCrop ) &&
      62       20878 :             ( mnBottomCrop == rAttr.mnBottomCrop ) &&
      63       20878 :             ( mnRotate10 == rAttr.mnRotate10 ) &&
      64       20878 :             ( mnContPercent == rAttr.mnContPercent ) &&
      65       20878 :             ( mnLumPercent == rAttr.mnLumPercent ) &&
      66       20878 :             ( mnRPercent == rAttr.mnRPercent ) &&
      67       20878 :             ( mnGPercent == rAttr.mnGPercent ) &&
      68       20878 :             ( mnBPercent == rAttr.mnBPercent ) &&
      69       20878 :             ( mbInvert == rAttr.mbInvert ) &&
      70       31317 :             ( mcTransparency == rAttr.mcTransparency ) &&
      71       20878 :             ( meDrawMode == rAttr.meDrawMode ) );
      72             : }
      73             : 
      74             : 
      75             : 
      76           0 : SvStream& ReadGraphicAttr( SvStream& rIStm, GraphicAttr& rAttr )
      77             : {
      78           0 :     VersionCompat   aCompat( rIStm, StreamMode::READ );
      79             :     sal_uInt32      nTmp32, nTmpMirrFlags;
      80             :     sal_uInt16      nTmp16;
      81             : 
      82           0 :     rIStm.ReadUInt32( nTmp32 ).ReadUInt32( nTmp32 ).ReadDouble( rAttr.mfGamma ).ReadUInt32( nTmpMirrFlags ).ReadUInt16( rAttr.mnRotate10 );
      83           0 :     rAttr.mnMirrFlags = static_cast<BmpMirrorFlags>(nTmpMirrFlags);
      84           0 :     rIStm.ReadInt16( rAttr.mnContPercent ).ReadInt16( rAttr.mnLumPercent ).ReadInt16( rAttr.mnRPercent ).ReadInt16( rAttr.mnGPercent ).ReadInt16( rAttr.mnBPercent );
      85           0 :     rIStm.ReadCharAsBool( rAttr.mbInvert ).ReadUChar( rAttr.mcTransparency ).ReadUInt16( nTmp16 );
      86           0 :     rAttr.meDrawMode = (GraphicDrawMode) nTmp16;
      87             : 
      88           0 :     if( aCompat.GetVersion() >= 2 )
      89             :     {
      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, StreamMode::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( static_cast<sal_uInt32>(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.WriteBool( rAttr.mbInvert ).WriteUChar( rAttr.mcTransparency ).WriteUInt16( rAttr.meDrawMode );
     113           0 :     rOStm.WriteInt32( rAttr.mnLeftCrop )
     114           0 :          .WriteInt32( rAttr.mnTopCrop )
     115           0 :          .WriteInt32( rAttr.mnRightCrop )
     116           0 :          .WriteInt32( rAttr.mnBottomCrop );
     117             : 
     118           0 :     return rOStm;
     119             : }
     120             : 
     121             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11