LCOV - code coverage report
Current view: top level - canvas/source/cairo - cairo_canvasbitmap.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 4 75.0 %
Date: 2015-06-13 12:38:46 Functions: 8 12 66.7 %
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_SOURCE_CAIRO_CAIRO_CANVASBITMAP_HXX
      21             : #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_CANVASBITMAP_HXX
      22             : 
      23             : #include <cppuhelper/compbase4.hxx>
      24             : 
      25             : #include <com/sun/star/lang/XServiceInfo.hpp>
      26             : #include <com/sun/star/rendering/XBitmapCanvas.hpp>
      27             : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
      28             : #include <com/sun/star/beans/XFastPropertySet.hpp>
      29             : #include <comphelper/uno3.hxx>
      30             : 
      31             : #include <basegfx/vector/b2isize.hxx>
      32             : 
      33             : #include <boost/shared_ptr.hpp>
      34             : 
      35             : #include <canvas/base/basemutexhelper.hxx>
      36             : #include <canvas/base/integerbitmapbase.hxx>
      37             : 
      38             : #include "cairo_canvashelper.hxx"
      39             : #include "cairo_repainttarget.hxx"
      40             : #include "cairo_spritecanvas.hxx"
      41             : 
      42             : 
      43             : /* Definition of CanvasBitmap class */
      44             : 
      45             : namespace cairocanvas
      46             : {
      47             :     typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas,
      48             :                                               ::com::sun::star::rendering::XIntegerBitmap,
      49             :                                               ::com::sun::star::lang::XServiceInfo,
      50             :                                               ::com::sun::star::beans::XFastPropertySet >   CanvasBitmapBase_Base;
      51           4 :     class CanvasBitmapSpriteSurface_Base :
      52             :         public ::canvas::BaseMutexHelper<CanvasBitmapBase_Base>,
      53             :         public SurfaceProvider
      54             :     {
      55             :     };
      56             : 
      57             :     typedef ::canvas::IntegerBitmapBase<
      58             :         canvas::BitmapCanvasBase2<
      59             :             CanvasBitmapSpriteSurface_Base,
      60             :             CanvasHelper,
      61             :             ::osl::MutexGuard,
      62             :             ::cppu::OWeakObject> > CanvasBitmap_Base;
      63             : 
      64           4 :     class CanvasBitmap : public CanvasBitmap_Base,
      65             :                          public RepaintTarget
      66             :     {
      67             :     public:
      68             :         /** Create a canvas bitmap for the given surface
      69             : 
      70             :             @param rSize
      71             :             Size of the bitmap
      72             : 
      73             :             @param rDevice
      74             :             Reference device, with which bitmap should be compatible
      75             :         */
      76             :         CanvasBitmap( const ::basegfx::B2ISize& rSize,
      77             :                       const SurfaceProviderRef& rDevice,
      78             :                       ::com::sun::star::rendering::XGraphicDevice* pDevice,
      79             :                       bool                      bHasAlpha );
      80             : 
      81             :         /// Dispose all internal references
      82             :         virtual void disposeThis() SAL_OVERRIDE;
      83             : 
      84             :         // Forwarding the XComponent implementation to the
      85             :         // cppu::ImplHelper templated base
      86             :         //                                    Classname     Base doing refcounting        Base implementing the XComponent interface
      87             :         //                                       |                 |                            |
      88             :         //                                       V                 V                            V
      89         178 :         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasBitmap, CanvasBitmapBase_Base, ::cppu::WeakComponentImplHelperBase )
      90             : 
      91             :         // XServiceInfo
      92             :         virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             :         virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             : 
      96             :         // SurfaceProvider
      97             :         virtual ::cairo::SurfaceSharedPtr getSurface() SAL_OVERRIDE;
      98             :         virtual ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, int aContent = CAIRO_CONTENT_COLOR_ALPHA ) SAL_OVERRIDE;
      99             :         virtual ::cairo::SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) SAL_OVERRIDE;
     100             :         virtual ::cairo::SurfaceSharedPtr changeSurface( bool bHasAlpha, bool bCopyContent ) SAL_OVERRIDE;
     101             :         virtual OutputDevice* getOutputDevice() SAL_OVERRIDE;
     102             : 
     103             :         // RepaintTarget
     104             :         virtual bool repaint( const ::cairo::SurfaceSharedPtr&                pSurface,
     105             :                               const ::com::sun::star::rendering::ViewState&   viewState,
     106             :                               const ::com::sun::star::rendering::RenderState& renderState ) SAL_OVERRIDE;
     107             : 
     108             :         // XFastPropertySet
     109             :         // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
     110             :         // handle values have these meanings:
     111             :         // 0 ... get pointer to BitmapEx
     112             :         // 1 ... get X pixmap handle to rgb content
     113             :         // 2 ... get X pitmap handle to alpha mask
     114             :         // returned any contains either BitmapEx pointer or array of three Any value
     115             :         //     1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
     116             :         //     2nd the pixmap handle
     117             :         //     3rd the pixmap depth
     118             :         virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)  throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119           0 :         virtual void SAL_CALL setFastPropertyValue(sal_Int32, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE {}
     120             : 
     121             :     private:
     122             :         SurfaceProviderRef        mpSurfaceProvider;
     123             :         ::cairo::SurfaceSharedPtr mpBufferSurface;
     124             :         ::cairo::CairoSharedPtr   mpBufferCairo;
     125             : 
     126             :         const ::basegfx::B2ISize  maSize;
     127             :         const bool                mbHasAlpha;
     128             :     };
     129             : }
     130             : 
     131             : #endif // INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_CANVASBITMAP_HXX
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11