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

Generated by: LCOV version 1.10