LCOV - code coverage report
Current view: top level - include/canvas/base - bitmapcanvasbase.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 20 0.0 %
Date: 2014-04-14 Functions: 0 82 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_CANVAS_BASE_BITMAPCANVASBASE_HXX
      21             : #define INCLUDED_CANVAS_BASE_BITMAPCANVASBASE_HXX
      22             : 
      23             : #include <canvas/base/canvasbase.hxx>
      24             : #include <com/sun/star/rendering/XBitmapCanvas.hpp>
      25             : 
      26             : namespace canvas
      27             : {
      28             :     /** Helper template to handle XBitmapCanvas method forwarding to
      29             :         BitmapCanvasHelper
      30             : 
      31             :         Use this helper to handle the XBitmapCanvas part of your
      32             :         implementation.
      33             : 
      34             :         @tpl Base
      35             :         Base class to use, most probably one of the
      36             :         WeakComponentImplHelperN templates with the appropriate
      37             :         interfaces. At least XBitmapCanvas should be among them (why
      38             :         else would you use this template, then?). Base class must have
      39             :         an Base( const Mutex& ) constructor (like the
      40             :         WeakComponentImplHelperN templates have).
      41             : 
      42             :         @tpl CanvasHelper
      43             :         Canvas helper implementation for the backend in question
      44             : 
      45             :         @tpl Mutex
      46             :         Lock strategy to use. Defaults to using the
      47             :         OBaseMutex-provided lock.  Everytime one of the methods is
      48             :         entered, an object of type Mutex is created with m_aMutex as
      49             :         the sole parameter, and destroyed again when the method scope
      50             :         is left.
      51             : 
      52             :         @tpl UnambiguousBase
      53             :         Optional unambiguous base class for XInterface of Base. It's
      54             :         sometimes necessary to specify this parameter, e.g. if Base
      55             :         derives from multiple UNO interface (were each provides its
      56             :         own version of XInterface, making the conversion ambiguous)
      57             : 
      58             :         @see CanvasBase for further contractual requirements towards
      59             :         the CanvasHelper type, and some examples.
      60             :      */
      61             :     template< class Base,
      62             :               class CanvasHelper,
      63             :               class Mutex=::osl::MutexGuard,
      64           0 :               class UnambiguousBase=::com::sun::star::uno::XInterface > class BitmapCanvasBase :
      65             :         public CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
      66             :     {
      67             :     public:
      68             :         typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >    BaseType;
      69             : 
      70             :         // XBitmap
      71           0 :         virtual ::com::sun::star::geometry::IntegerSize2D SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE
      72             :         {
      73           0 :             typename BaseType::MutexType aGuard( BaseType::m_aMutex );
      74             : 
      75           0 :             return BaseType::maCanvasHelper.getSize();
      76             :         }
      77             : 
      78           0 :         virtual sal_Bool SAL_CALL hasAlpha(  ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE
      79             :         {
      80           0 :             typename BaseType::MutexType aGuard( BaseType::m_aMutex );
      81             : 
      82           0 :             return BaseType::maCanvasHelper.hasAlpha();
      83             :         }
      84             : 
      85           0 :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize,
      86             :                                                                                                                    sal_Bool                                      beFast ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE
      87             :         {
      88           0 :             typename BaseType::MutexType aGuard( BaseType::m_aMutex );
      89             : 
      90           0 :             return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast );
      91             :         }
      92             : 
      93             :     };
      94             : 
      95             :     template< class Base,
      96             :               class CanvasHelper,
      97             :               class Mutex=::osl::MutexGuard,
      98           0 :               class UnambiguousBase=::com::sun::star::uno::XInterface > class BitmapCanvasBase2 :
      99             :         public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
     100             :     {
     101             :         typedef BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
     102             :             BaseType;
     103             : 
     104             :     public:
     105             :         // XBitmapCanvas
     106           0 :         virtual void SAL_CALL copyRect( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas >&   sourceCanvas,
     107             :                                         const ::com::sun::star::geometry::RealRectangle2D&                                      sourceRect,
     108             :                                         const ::com::sun::star::rendering::ViewState&                                           sourceViewState,
     109             :                                         const ::com::sun::star::rendering::RenderState&                                         sourceRenderState,
     110             :                                         const ::com::sun::star::geometry::RealRectangle2D&                                      destRect,
     111             :                                         const ::com::sun::star::rendering::ViewState&                                           destViewState,
     112             :                                         const ::com::sun::star::rendering::RenderState&                                         destRenderState ) throw (::com::sun::star::lang::IllegalArgumentException,
     113             :                                                                                                                                                          ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     114             :         {
     115           0 :             tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState,
     116             :                               destRect, destViewState, destRenderState,
     117             :                               BOOST_CURRENT_FUNCTION,
     118           0 :                               static_cast< typename BaseType::UnambiguousBaseType* >(this));
     119             : 
     120           0 :             typename BaseType::BaseType::MutexType aGuard( BaseType::m_aMutex );
     121             : 
     122           0 :             BaseType::BaseType::mbSurfaceDirty = true;
     123           0 :             BaseType::BaseType::maCanvasHelper.modifying();
     124             : 
     125           0 :             BaseType::BaseType::maCanvasHelper.copyRect( this,
     126             :                                                sourceCanvas,
     127             :                                                sourceRect,
     128             :                                                sourceViewState,
     129             :                                                sourceRenderState,
     130             :                                                destRect,
     131             :                                                destViewState,
     132           0 :                                                destRenderState );
     133           0 :         }
     134             :     };
     135             : }
     136             : 
     137             : #endif // INCLUDED_CANVAS_BASE_BITMAPCANVASBASE_HXX
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10