LCOV - code coverage report
Current view: top level - svx/source/sdr/primitive2d - sdrprimitivetools.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 26 26 100.0 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 37 72 51.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
      30                 :            : #include <vcl/bmpacc.hxx>
      31                 :            : #include <osl/mutex.hxx>
      32                 :            : #include <vcl/lazydelete.hxx>
      33                 :            : 
      34                 :            : //////////////////////////////////////////////////////////////////////////////
      35                 :            : // helper methods
      36                 :            : 
      37                 :            : namespace drawinglayer
      38                 :            : {
      39                 :            :     namespace primitive2d
      40                 :            :     {
      41                 :       1120 :         BitmapEx createDefaultCross_3x3(const basegfx::BColor& rBColor)
      42                 :            :         {
      43 [ +  + ][ +  - ]:       1120 :             static vcl::DeleteOnDeinit< BitmapEx > aRetVal(0);
         [ +  - ][ #  # ]
      44 [ +  + ][ +  - ]:       1120 :             static basegfx::BColor aColor;
      45         [ +  - ]:       1120 :             ::osl::Mutex m_mutex;
      46                 :            : 
      47 [ +  + ][ -  + ]:       1120 :             if(!aRetVal.get() || rBColor != aColor)
                 [ +  + ]
      48                 :            :             {
      49                 :            :                 // copy values
      50         [ +  - ]:         23 :                 aColor = rBColor;
      51                 :            : 
      52                 :            :                 // create bitmap
      53         [ +  - ]:         23 :                 Bitmap aContent(Size(3, 3), 24);
      54         [ +  - ]:         23 :                 Bitmap aMask(Size(3, 3), 1);
      55         [ +  - ]:         23 :                 BitmapWriteAccess* pWContent = aContent.AcquireWriteAccess();
      56         [ +  - ]:         23 :                 BitmapWriteAccess* pWMask = aMask.AcquireWriteAccess();
      57                 :            :                 OSL_ENSURE(pWContent && pWMask, "No WriteAccess to bitmap (!)");
      58                 :         23 :                 const Color aVCLColor(aColor);
      59                 :         23 :                 const BitmapColor aPixColor(aVCLColor);
      60                 :         23 :                 const BitmapColor aMaskColor(0x01);
      61                 :            : 
      62                 :            :                 // Y,X unusual order (!)
      63         [ +  - ]:         23 :                 pWContent->SetPixel(0, 1, aPixColor);
      64         [ +  - ]:         23 :                 pWContent->SetPixel(1, 0, aPixColor);
      65         [ +  - ]:         23 :                 pWContent->SetPixel(1, 1, aPixColor);
      66         [ +  - ]:         23 :                 pWContent->SetPixel(1, 2, aPixColor);
      67         [ +  - ]:         23 :                 pWContent->SetPixel(2, 1, aPixColor);
      68                 :            : 
      69         [ +  - ]:         23 :                 pWMask->SetPixel(0, 0, aMaskColor);
      70         [ +  - ]:         23 :                 pWMask->SetPixel(0, 2, aMaskColor);
      71         [ +  - ]:         23 :                 pWMask->SetPixel(2, 0, aMaskColor);
      72         [ +  - ]:         23 :                 pWMask->SetPixel(2, 2, aMaskColor);
      73                 :            : 
      74         [ +  - ]:         23 :                 aContent.ReleaseAccess(pWContent);
      75         [ +  - ]:         23 :                 aMask.ReleaseAccess(pWMask);
      76                 :            : 
      77                 :            :                 // create and exchange at aRetVal
      78 [ +  - ][ +  - ]:         23 :                 delete aRetVal.set(new BitmapEx(aContent, aMask));
         [ -  + ][ #  # ]
         [ +  - ][ +  - ]
      79                 :            :             }
      80                 :            : 
      81 [ +  - ][ +  - ]:       1120 :             return aRetVal.get() ? *aRetVal.get() : BitmapEx();
         [ #  # ][ +  - ]
      82                 :            :         }
      83                 :            :     } // end of namespace primitive2d
      84                 :            : } // end of namespace drawinglayer
      85                 :            : 
      86                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10