LCOV - code coverage report
Current view: top level - include/canvas/base - sprite.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 6 0.0 %
Date: 2014-04-14 Functions: 0 3 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_SPRITE_HXX
      21             : #define INCLUDED_CANVAS_BASE_SPRITE_HXX
      22             : 
      23             : #include <rtl/ref.hxx>
      24             : #include <com/sun/star/lang/XComponent.hpp>
      25             : #include <com/sun/star/rendering/XCanvas.hpp>
      26             : #include <basegfx/point/b2dpoint.hxx>
      27             : #include <basegfx/vector/b2dsize.hxx>
      28             : 
      29             : namespace basegfx
      30             : {
      31             :     class B2DPoint;
      32             :     class B2DVector;
      33             :     class B2DRange;
      34             : }
      35             : 
      36             : namespace canvas
      37             : {
      38             :     /* Definition of Sprite interface (as we mix with UNO here, has to
      39             :        be XInterface - reference holders to a Sprite must be able to
      40             :        control lifetime of reference target)
      41             :      */
      42             : 
      43             :     /** Helper interface to connect SpriteCanvas with various
      44             :         sprite implementations.
      45             : 
      46             :         This interface should be implemented from every sprite class,
      47             :         as it provides essential repaint and update area facilitates.
      48             : 
      49             :         @derive typically, each canvas implementation will derive
      50             :         another interface from this one, that adds rendering
      51             :         functionality (which, of course, is impossible here in a
      52             :         generic way)
      53             :     */
      54           0 :     class Sprite : public ::com::sun::star::lang::XComponent
      55             :     {
      56             :     public:
      57             :         typedef ::rtl::Reference< Sprite > Reference;
      58             : 
      59             :         /** Query whether sprite update will fully cover the given area.
      60             : 
      61             :             Use this method to determine whether any background
      62             :             content (regardless of static or sprite) needs an update
      63             :             before rendering this sprite.
      64             : 
      65             :             @return true, if sprite redraw will fully overwrite given
      66             :             area (and thus, the background need not be redrawn
      67             :             beforehand).
      68             :          */
      69             :         virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const = 0;
      70             : 
      71             :         /** Query whether content has changed
      72             :          */
      73             :         virtual bool isContentChanged() const = 0;
      74             : 
      75             :         /** Query position of the left, top pixel of the sprite
      76             :          */
      77             :         virtual ::basegfx::B2DPoint getPosPixel() const = 0;
      78             : 
      79             :         /** Query size of the sprite in pixel.
      80             :          */
      81             :         virtual ::basegfx::B2DVector getSizePixel() const = 0;
      82             : 
      83             :         /** Get area that is currently covered by the sprite
      84             : 
      85             :             This area is already adapted to clipping, alpha and
      86             :             transformation state of this sprite.
      87             :          */
      88             :         virtual ::basegfx::B2DRange getUpdateArea() const = 0;
      89             : 
      90             :         /** Query sprite priority
      91             :          */
      92             :         virtual double              getPriority() const = 0;
      93             : 
      94             :     protected:
      95           0 :         ~Sprite() {}
      96             :     };
      97             : 
      98             :     /** Functor providing a StrictWeakOrdering for sprite references
      99             :      */
     100             :     struct SpriteWeakOrder
     101             :     {
     102           0 :         bool operator()( const Sprite::Reference& rLHS,
     103             :                          const Sprite::Reference& rRHS )
     104             :         {
     105           0 :             const double nPrioL( rLHS->getPriority() );
     106           0 :             const double nPrioR( rRHS->getPriority() );
     107             : 
     108             :             // if prios are equal, tie-break on ptr value
     109           0 :             return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
     110             :         }
     111             :     };
     112             : }
     113             : 
     114             : #endif // INCLUDED_CANVAS_BASE_SPRITE_HXX
     115             : 
     116             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10