LCOV - code coverage report
Current view: top level - libreoffice/svx/source/sdr/primitive2d - sdrprimitivetools.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 26 26 100.0 %
Date: 2012-12-27 Functions: 1 1 100.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             : #include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
      21             : #include <vcl/bmpacc.hxx>
      22             : #include <osl/mutex.hxx>
      23             : #include <vcl/lazydelete.hxx>
      24             : 
      25             : //////////////////////////////////////////////////////////////////////////////
      26             : // helper methods
      27             : 
      28             : namespace drawinglayer
      29             : {
      30             :     namespace primitive2d
      31             :     {
      32           4 :         BitmapEx createDefaultCross_3x3(const basegfx::BColor& rBColor)
      33             :         {
      34           4 :             static vcl::DeleteOnDeinit< BitmapEx > aRetVal(0);
      35           4 :             static basegfx::BColor aColor;
      36           4 :             ::osl::Mutex m_mutex;
      37             : 
      38           4 :             if(!aRetVal.get() || rBColor != aColor)
      39             :             {
      40             :                 // copy values
      41           1 :                 aColor = rBColor;
      42             : 
      43             :                 // create bitmap
      44           1 :                 Bitmap aContent(Size(3, 3), 24);
      45           1 :                 Bitmap aMask(Size(3, 3), 1);
      46           1 :                 BitmapWriteAccess* pWContent = aContent.AcquireWriteAccess();
      47           1 :                 BitmapWriteAccess* pWMask = aMask.AcquireWriteAccess();
      48             :                 OSL_ENSURE(pWContent && pWMask, "No WriteAccess to bitmap (!)");
      49           1 :                 const Color aVCLColor(aColor);
      50           1 :                 const BitmapColor aPixColor(aVCLColor);
      51           1 :                 const BitmapColor aMaskColor(0x01);
      52             : 
      53             :                 // Y,X unusual order (!)
      54           1 :                 pWContent->SetPixel(0, 1, aPixColor);
      55           1 :                 pWContent->SetPixel(1, 0, aPixColor);
      56           1 :                 pWContent->SetPixel(1, 1, aPixColor);
      57           1 :                 pWContent->SetPixel(1, 2, aPixColor);
      58           1 :                 pWContent->SetPixel(2, 1, aPixColor);
      59             : 
      60           1 :                 pWMask->SetPixel(0, 0, aMaskColor);
      61           1 :                 pWMask->SetPixel(0, 2, aMaskColor);
      62           1 :                 pWMask->SetPixel(2, 0, aMaskColor);
      63           1 :                 pWMask->SetPixel(2, 2, aMaskColor);
      64             : 
      65           1 :                 aContent.ReleaseAccess(pWContent);
      66           1 :                 aMask.ReleaseAccess(pWMask);
      67             : 
      68             :                 // create and exchange at aRetVal
      69           1 :                 delete aRetVal.set(new BitmapEx(aContent, aMask));
      70             :             }
      71             : 
      72           4 :             return aRetVal.get() ? *aRetVal.get() : BitmapEx();
      73             :         }
      74             :     } // end of namespace primitive2d
      75             : } // end of namespace drawinglayer
      76             : 
      77             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10