LCOV - code coverage report
Current view: top level - canvas/source/cairo - cairo_canvascustomsprite.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 3 0.0 %
Date: 2014-11-03 Functions: 0 11 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_CANVASCUSTOMSPRITE_HXX
      21             : #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_CANVASCUSTOMSPRITE_HXX
      22             : 
      23             : #include <cppuhelper/compbase4.hxx>
      24             : #include <comphelper/uno3.hxx>
      25             : 
      26             : #include <com/sun/star/lang/XServiceInfo.hpp>
      27             : #include <com/sun/star/lang/XComponent.hpp>
      28             : #include <com/sun/star/rendering/XCustomSprite.hpp>
      29             : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
      30             : #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
      31             : 
      32             : #include <basegfx/point/b2dpoint.hxx>
      33             : #include <basegfx/vector/b2isize.hxx>
      34             : #include <basegfx/matrix/b2dhommatrix.hxx>
      35             : 
      36             : #include <canvas/base/basemutexhelper.hxx>
      37             : #include <canvas/base/canvascustomspritebase.hxx>
      38             : 
      39             : #include "cairo_sprite.hxx"
      40             : #include "cairo_cairo.hxx"
      41             : #include "cairo_canvashelper.hxx"
      42             : #include "cairo_repainttarget.hxx"
      43             : #include "cairo_spritehelper.hxx"
      44             : #include "cairo_spritecanvas.hxx"
      45             : 
      46             : 
      47             : namespace cairocanvas
      48             : {
      49             :     typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XCustomSprite,
      50             :                                                ::com::sun::star::rendering::XBitmapCanvas,
      51             :                                               ::com::sun::star::rendering::XIntegerBitmap,
      52             :                                                 ::com::sun::star::lang::XServiceInfo >  CanvasCustomSpriteBase_Base;
      53             :     /** Mixin Sprite
      54             : 
      55             :         Have to mixin the Sprite interface before deriving from
      56             :         ::canvas::CanvasCustomSpriteBase, as this template should
      57             :         already implement some of those interface methods.
      58             : 
      59             :         The reason why this appears kinda convoluted is the fact that
      60             :         we cannot specify non-IDL types as WeakComponentImplHelperN
      61             :         template args, and furthermore, don't want to derive
      62             :         ::canvas::CanvasCustomSpriteBase directly from
      63             :         ::canvas::Sprite (because derivees of
      64             :         ::canvas::CanvasCustomSpriteBase have to explicitly forward
      65             :         the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
      66             :         anyway). Basically, ::canvas::CanvasCustomSpriteBase should
      67             :         remain a base class that provides implementation, not to
      68             :         enforce any specific interface on its derivees.
      69             :      */
      70           0 :     class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
      71             :                                                  public Sprite,
      72             :                                               public SurfaceProvider
      73             :     {
      74             :     };
      75             : 
      76             :     typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
      77             :                                               SpriteHelper,
      78             :                                               CanvasHelper,
      79             :                                               ::osl::MutexGuard,
      80             :                                               ::cppu::OWeakObject >                     CanvasCustomSpriteBaseT;
      81             : 
      82             :     /* Definition of CanvasCustomSprite class */
      83             : 
      84           0 :     class CanvasCustomSprite : public CanvasCustomSpriteBaseT,
      85             :                                public RepaintTarget
      86             :     {
      87             :     public:
      88             :         /** Create a custom sprite
      89             : 
      90             :             @param rSpriteSize
      91             :             Size of the sprite in pixel
      92             : 
      93             :             @param rRefDevice
      94             :             Associated output device
      95             : 
      96             :             @param rSpriteCanvas
      97             :             Target canvas
      98             : 
      99             :             @param rDevice
     100             :             Target DX device
     101             :          */
     102             :         CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D&   rSpriteSize,
     103             :                             const SpriteCanvasRef&                          rRefDevice );
     104             : 
     105             :         virtual void disposeThis() SAL_OVERRIDE;
     106             : 
     107             :         // Forwarding the XComponent implementation to the
     108             :         // cppu::ImplHelper templated base
     109             :         //                                    Classname           Base doing refcount          Base implementing the XComponent interface
     110             :         //                                          |                    |                         |
     111             :         //                                          V                    V                         V
     112           0 :         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase )
     113             : 
     114             :         // XServiceInfo
     115             :         virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     116             :         virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     117             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()  throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     118             : 
     119             :         // Sprite
     120             :         virtual void redraw( const ::cairo::CairoSharedPtr& pCairo,
     121             :                              bool                           bBufferedUpdate ) const SAL_OVERRIDE;
     122             :         virtual void redraw( const ::cairo::CairoSharedPtr& pCairo,
     123             :                              const ::basegfx::B2DPoint&     rOrigOutputPos,
     124             :                              bool                           bBufferedUpdate ) const SAL_OVERRIDE;
     125             : 
     126             :         // RepaintTarget
     127             :         virtual bool repaint( const ::cairo::SurfaceSharedPtr&                pSurface,
     128             :                               const ::com::sun::star::rendering::ViewState&   viewState,
     129             :                               const ::com::sun::star::rendering::RenderState& renderState ) SAL_OVERRIDE;
     130             : 
     131             :         // SurfaceProvider
     132             :         virtual ::cairo::SurfaceSharedPtr getSurface() SAL_OVERRIDE;
     133             :         virtual ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, ::cairo::Content aContent = CAIRO_CONTENT_COLOR_ALPHA ) SAL_OVERRIDE;
     134             :         virtual ::cairo::SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) SAL_OVERRIDE;
     135             :         virtual ::cairo::SurfaceSharedPtr changeSurface( bool bHasAlpha, bool bCopyContent ) SAL_OVERRIDE;
     136             :         virtual OutputDevice* getOutputDevice() SAL_OVERRIDE;
     137             : 
     138             :     private:
     139             :         /** MUST hold here, too, since CanvasHelper only contains a
     140             :             raw pointer (without refcounting)
     141             :         */
     142             :         SpriteCanvasRef           mpSpriteCanvas;
     143             :         ::cairo::SurfaceSharedPtr mpBufferSurface;
     144             :         ::basegfx::B2ISize        maSize;
     145             :     };
     146             : }
     147             : 
     148             : #endif // INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_CANVASCUSTOMSPRITE_HXX
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10