LCOV - code coverage report
Current view: top level - libreoffice/canvas/source/vcl - canvasbitmap.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-27 Functions: 0 10 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             : 
      21             : #include <canvas/debug.hxx>
      22             : #include <tools/diagnose_ex.h>
      23             : #include "canvasbitmap.hxx"
      24             : 
      25             : #include <vcl/bmpacc.hxx>
      26             : 
      27             : using namespace ::com::sun::star;
      28             : 
      29             : 
      30             : namespace vclcanvas
      31             : {
      32             :     // Currently, the only way to generate an XBitmap is from
      33             :     // XGraphicDevice.getCompatibleBitmap(). Therefore, we don't even
      34             :     // take a bitmap here, but a VDev directly.
      35           0 :     CanvasBitmap::CanvasBitmap( const ::Size&                  rSize,
      36             :                                 bool                           bAlphaBitmap,
      37             :                                 rendering::XGraphicDevice&     rDevice,
      38           0 :                                 const OutDevProviderSharedPtr& rOutDevProvider )
      39             :     {
      40             :         // create bitmap for given reference device
      41             :         // ========================================
      42           0 :         const sal_uInt16 nBitCount( (sal_uInt16)24U );
      43           0 :         const BitmapPalette*    pPalette = NULL;
      44             : 
      45           0 :         Bitmap aBitmap( rSize, nBitCount, pPalette );
      46             : 
      47             :         // only create alpha channel bitmap, if factory requested
      48             :         // that. Providing alpha-channeled bitmaps by default has,
      49             :         // especially under VCL, a huge performance penalty (have to
      50             :         // use alpha VDev, then).
      51           0 :         if( bAlphaBitmap )
      52             :         {
      53           0 :             AlphaMask   aAlpha ( rSize );
      54             : 
      55             :             maCanvasHelper.init( BitmapEx( aBitmap, aAlpha ),
      56             :                                  rDevice,
      57           0 :                                  rOutDevProvider );
      58             :         }
      59             :         else
      60             :         {
      61             :             maCanvasHelper.init( BitmapEx( aBitmap ),
      62             :                                  rDevice,
      63           0 :                                  rOutDevProvider );
      64           0 :         }
      65           0 :     }
      66             : 
      67           0 :     CanvasBitmap::CanvasBitmap( const BitmapEx&                rBitmap,
      68             :                                 rendering::XGraphicDevice&     rDevice,
      69           0 :                                 const OutDevProviderSharedPtr& rOutDevProvider )
      70             :     {
      71           0 :         maCanvasHelper.init( rBitmap, rDevice, rOutDevProvider );
      72           0 :     }
      73             : 
      74             : #define IMPLEMENTATION_NAME "VCLCanvas.CanvasBitmap"
      75             : #define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
      76             : 
      77           0 :     ::rtl::OUString SAL_CALL CanvasBitmap::getImplementationName(  ) throw (uno::RuntimeException)
      78             :     {
      79           0 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
      80             :     }
      81             : 
      82           0 :     sal_Bool SAL_CALL CanvasBitmap::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
      83             :     {
      84           0 :         return ServiceName == SERVICE_NAME;
      85             :     }
      86             : 
      87           0 :     uno::Sequence< ::rtl::OUString > SAL_CALL CanvasBitmap::getSupportedServiceNames(  ) throw (uno::RuntimeException)
      88             :     {
      89           0 :         uno::Sequence< ::rtl::OUString > aRet(1);
      90           0 :         aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
      91             : 
      92           0 :         return aRet;
      93             :     }
      94             : 
      95           0 :     BitmapEx CanvasBitmap::getBitmap() const
      96             :     {
      97           0 :         SolarMutexGuard aGuard;
      98             : 
      99             :         // TODO(T3): Rework to use shared_ptr all over the place for
     100             :         // BmpEx. This is highly un-threadsafe
     101           0 :         return maCanvasHelper.getBitmap();
     102             :     }
     103             : 
     104           0 :     bool CanvasBitmap::repaint( const GraphicObjectSharedPtr& rGrf,
     105             :                                 const rendering::ViewState&   viewState,
     106             :                                 const rendering::RenderState& renderState,
     107             :                                 const ::Point&                rPt,
     108             :                                 const ::Size&                 rSz,
     109             :                                 const GraphicAttr&            rAttr ) const
     110             :     {
     111           0 :         SolarMutexGuard aGuard;
     112             : 
     113           0 :         mbSurfaceDirty = true;
     114             : 
     115           0 :         return maCanvasHelper.repaint( rGrf, viewState, renderState, rPt, rSz, rAttr );
     116             :     }
     117             : 
     118           0 :     uno::Any SAL_CALL CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle ) throw (uno::RuntimeException)
     119             :     {
     120           0 :         if( nHandle == 0 ) {
     121           0 :             BitmapEx* pBitmapEx = new BitmapEx( getBitmap() );
     122             : 
     123           0 :             return uno::Any( reinterpret_cast<sal_Int64>( pBitmapEx ) );
     124             :         }
     125             : 
     126           0 :         return uno::Any( sal_Int64(0) );
     127             :     }
     128           0 : }
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10