LCOV - code coverage report
Current view: top level - vcl/inc - impoct.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 54 0.0 %
Date: 2014-04-14 Functions: 0 11 0.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             : #ifndef INCLUDED_VCL_INC_IMPOCT_HXX
      21             : #define INCLUDED_VCL_INC_IMPOCT_HXX
      22             : 
      23             : #include "octree.hxx"
      24             : 
      25             : // - ImpErrorQuad -
      26             : 
      27             : class ImpErrorQuad
      28             : {
      29             :     long nRed;
      30             :     long nGreen;
      31             :     long nBlue;
      32             : 
      33             : public:
      34             : 
      35           0 :     ImpErrorQuad()
      36             :         : nRed(0)
      37             :         , nGreen(0)
      38           0 :         , nBlue(0)
      39             :     {
      40           0 :     }
      41             : 
      42           0 :     ImpErrorQuad( const BitmapColor& rColor )
      43           0 :         : nRed( (long) rColor.GetRed() << 5L )
      44           0 :         , nGreen( (long) rColor.GetGreen() << 5L )
      45           0 :         , nBlue( (long) rColor.GetBlue() << 5L )
      46             :     {
      47           0 :     }
      48             : 
      49             :     inline void             operator=( const BitmapColor& rColor );
      50             :     inline ImpErrorQuad&    operator-=( const BitmapColor& rColor );
      51             : 
      52             :     inline void             ImplAddColorError1( const ImpErrorQuad& rErrQuad );
      53             :     inline void             ImplAddColorError3( const ImpErrorQuad& rErrQuad );
      54             :     inline void             ImplAddColorError5( const ImpErrorQuad& rErrQuad );
      55             :     inline void             ImplAddColorError7( const ImpErrorQuad& rErrQuad );
      56             : 
      57             :     inline BitmapColor      ImplGetColor();
      58             : };
      59             : 
      60           0 : inline void ImpErrorQuad::operator=( const BitmapColor& rColor )
      61             : {
      62           0 :     nRed = (long) rColor.GetRed() << 5L;
      63           0 :     nGreen = (long) rColor.GetGreen() << 5L;
      64           0 :     nBlue = (long) rColor.GetBlue() << 5L;
      65           0 : }
      66             : 
      67           0 : inline ImpErrorQuad& ImpErrorQuad::operator-=( const BitmapColor& rColor )
      68             : {
      69           0 :     nRed -= ( (long) rColor.GetRed() << 5L );
      70           0 :     nGreen -= ( (long) rColor.GetGreen() << 5L );
      71           0 :     nBlue -= ( (long) rColor.GetBlue() << 5L );
      72             : 
      73           0 :     return *this;
      74             : }
      75             : 
      76           0 : inline void ImpErrorQuad::ImplAddColorError1( const ImpErrorQuad& rErrQuad )
      77             : {
      78           0 :     nRed += ( rErrQuad.nRed >> 4L );
      79           0 :     nGreen += ( rErrQuad.nGreen >> 4L );
      80           0 :     nBlue += ( rErrQuad.nBlue >> 4L );
      81           0 : }
      82             : 
      83           0 : inline void ImpErrorQuad::ImplAddColorError3( const ImpErrorQuad& rErrQuad )
      84             : {
      85           0 :     nRed += ( rErrQuad.nRed * 3L >> 4L );
      86           0 :     nGreen += ( rErrQuad.nGreen * 3L >> 4L );
      87           0 :     nBlue += ( rErrQuad.nBlue * 3L >> 4L );
      88           0 : }
      89             : 
      90           0 : inline void ImpErrorQuad::ImplAddColorError5( const ImpErrorQuad& rErrQuad )
      91             : {
      92           0 :     nRed += ( rErrQuad.nRed * 5L >> 4L );
      93           0 :     nGreen += ( rErrQuad.nGreen * 5L >> 4L );
      94           0 :     nBlue += ( rErrQuad.nBlue * 5L >> 4L );
      95           0 : }
      96             : 
      97           0 : inline void ImpErrorQuad::ImplAddColorError7( const ImpErrorQuad& rErrQuad )
      98             : {
      99           0 :     nRed += ( rErrQuad.nRed * 7L >> 4L );
     100           0 :     nGreen += ( rErrQuad.nGreen * 7L >> 4L );
     101           0 :     nBlue += ( rErrQuad.nBlue *7L >> 4L );
     102           0 : }
     103             : 
     104           0 : inline BitmapColor ImpErrorQuad::ImplGetColor()
     105             : {
     106           0 :     return BitmapColor( (sal_uInt8) ( ( nRed < 0L ? 0L : nRed > 8160L ? 8160L : nRed ) >> 5L ),
     107           0 :                         (sal_uInt8) ( ( nGreen < 0L ? 0L : nGreen > 8160L ? 8160L : nGreen ) >> 5L ),
     108           0 :                         (sal_uInt8) ( ( nBlue < 0L ? 0L : nBlue > 8160L ? 8160L : nBlue ) >> 5L ) );
     109             : }
     110             : 
     111             : // - NodeCache -
     112             : 
     113             : class ImpNodeCache
     114             : {
     115             :     OctreeNode*         pActNode;
     116             : 
     117             : public:
     118             : 
     119             :                         ImpNodeCache( const sal_uLong nInitSize );
     120             :                         ~ImpNodeCache();
     121             : 
     122             :     inline OctreeNode*  ImplGetFreeNode();
     123             :     inline void         ImplReleaseNode( OctreeNode* pNode );
     124             : };
     125             : 
     126           0 : inline OctreeNode* ImpNodeCache::ImplGetFreeNode()
     127             : {
     128             :     OctreeNode* pNode;
     129             : 
     130           0 :     if ( !pActNode )
     131             :     {
     132           0 :         pActNode = new NODE;
     133           0 :         pActNode->pNextInCache = NULL;
     134             :     }
     135             : 
     136           0 :     pNode = pActNode;
     137           0 :     pActNode = pNode->pNextInCache;
     138           0 :     memset( pNode, 0, sizeof( NODE ) );
     139             : 
     140           0 :     return pNode;
     141             : }
     142             : 
     143           0 : inline void ImpNodeCache::ImplReleaseNode( OctreeNode* pNode )
     144             : {
     145           0 :     pNode->pNextInCache = pActNode;
     146           0 :     pActNode = pNode;
     147           0 : }
     148             : 
     149             : #endif // INCLUDED_VCL_INC_IMPOCT_HXX
     150             : 
     151             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10