LCOV - code coverage report
Current view: top level - include/vcl - animate.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 11 32 34.4 %
Date: 2014-11-03 Functions: 8 21 38.1 %
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_VCL_ANIMATE_HXX
      21             : #define INCLUDED_VCL_ANIMATE_HXX
      22             : 
      23             : #include <vcl/dllapi.h>
      24             : #include <vcl/timer.hxx>
      25             : #include <vcl/bitmapex.hxx>
      26             : 
      27             : #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
      28             : 
      29             : enum Disposal
      30             : {
      31             :     DISPOSE_NOT,
      32             :     DISPOSE_BACK,
      33             :     DISPOSE_FULL,
      34             :     DISPOSE_PREVIOUS
      35             : };
      36             : 
      37             : enum CycleMode
      38             : {
      39             :     CYCLE_NOT,
      40             :     CYCLE_NORMAL,
      41             :     CYCLE_FALLBACK,
      42             :     CYCLE_REVERS,
      43             :     CYCLE_REVERS_FALLBACK
      44             : };
      45             : 
      46        1196 : struct VCL_DLLPUBLIC AnimationBitmap
      47             : {
      48             :     BitmapEx        aBmpEx;
      49             :     Point           aPosPix;
      50             :     Size            aSizePix;
      51             :     long            nWait;
      52             :     Disposal        eDisposal;
      53             :     bool            bUserInput;
      54             : 
      55         230 :                     AnimationBitmap()
      56             :                         : nWait(0)
      57             :                         , eDisposal(DISPOSE_NOT)
      58         230 :                         , bUserInput(false)
      59         230 :                     {}
      60             : 
      61          14 :                     AnimationBitmap(
      62             :                         const BitmapEx& rBmpEx,
      63             :                         const Point& rPosPix,
      64             :                         const Size& rSizePix,
      65             :                         long _nWait = 0L,
      66             :                         Disposal _eDisposal = DISPOSE_NOT
      67             :                     ) :
      68             :                         aBmpEx      ( rBmpEx ),
      69             :                         aPosPix     ( rPosPix ),
      70             :                         aSizePix    ( rSizePix ),
      71             :                         nWait       ( _nWait ),
      72             :                         eDisposal   ( _eDisposal ),
      73          14 :                         bUserInput  ( false )
      74          14 :                     {}
      75             : 
      76           0 :     bool            operator==( const AnimationBitmap& rAnimBmp ) const
      77             :                         {
      78           0 :                             return( rAnimBmp.aBmpEx == aBmpEx &&
      79           0 :                                     rAnimBmp.aPosPix == aPosPix &&
      80           0 :                                     rAnimBmp.aSizePix == aSizePix &&
      81           0 :                                     rAnimBmp.nWait == nWait &&
      82           0 :                                     rAnimBmp.eDisposal == eDisposal &&
      83           0 :                                     rAnimBmp.bUserInput == bUserInput );
      84             :                         }
      85             : 
      86           0 :     bool            operator!=( const AnimationBitmap& rAnimBmp ) const
      87           0 :                         { return !( *this == rAnimBmp ); }
      88             : 
      89             :     bool            IsEqual( const AnimationBitmap& rAnimBmp ) const
      90             :                         {
      91             :                             return( rAnimBmp.aPosPix == aPosPix &&
      92             :                                     rAnimBmp.aSizePix == aSizePix &&
      93             :                                     rAnimBmp.nWait == nWait &&
      94             :                                     rAnimBmp.eDisposal == eDisposal &&
      95             :                                     rAnimBmp.bUserInput == bUserInput &&
      96             :                                     rAnimBmp.aBmpEx.IsEqual( aBmpEx ) );
      97             :                         }
      98             : 
      99             :     sal_uLong       GetChecksum() const;
     100             : };
     101             : 
     102           0 : struct AInfo
     103             : {
     104             :     Bitmap          aLastSaveBitmap;
     105             :     Bitmap          aBackBitmap;
     106             :     Rectangle       aClipRect;
     107             :     Size            aLastSaveSize;
     108             :     Point           aLastSavePoint;
     109             :     Point           aStartOrg;
     110             :     Size            aStartSize;
     111             :     OutputDevice*   pOutDev;
     112             :     void*           pViewData;
     113             :     long            nExtraData;
     114             :     bool            bWithSize;
     115             :     bool            bPause;
     116             : 
     117           0 :                     AInfo() : pOutDev( NULL ),
     118             :                               pViewData( NULL ),
     119             :                               nExtraData( 0L ),
     120             :                               bWithSize( false ),
     121           0 :                               bPause( false ) {}
     122             : };
     123             : 
     124             : class ImplAnimView;
     125             : typedef ::std::vector< AnimationBitmap* > AnimationBitmapList_impl;
     126             : typedef ::std::vector< ImplAnimView* > AnimViewList_impl;
     127             : 
     128             : class VCL_DLLPUBLIC Animation
     129             : {
     130             : public:
     131             :                     Animation();
     132             :                     Animation( const Animation& rAnimation );
     133             :                     ~Animation();
     134             : 
     135             :     Animation&      operator=( const Animation& rAnimation );
     136             :     bool            operator==( const Animation& rAnimation ) const;
     137             :     bool            operator!=( const Animation& rAnimation ) const
     138             :                         { return !(*this==rAnimation); }
     139             : 
     140             :     void            Clear();
     141             : 
     142             :     bool            Start(
     143             :                         OutputDevice* pOutDev,
     144             :                         const Point& rDestPt,
     145             :                         const Size& rDestSz,
     146             :                         long nExtraData = 0,
     147             :                         OutputDevice* pFirstFrameOutDev = NULL);
     148             : 
     149             :     void            Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 );
     150             : 
     151             :     void            Draw( OutputDevice* pOutDev, const Point& rDestPt ) const;
     152             :     void            Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const;
     153             : 
     154         244 :     bool            IsInAnimation() const { return mbIsInAnimation; }
     155             :     bool            IsTransparent() const;
     156             :     bool            IsTerminated() const { return mbLoopTerminated; }
     157             : 
     158           0 :     const Size&     GetDisplaySizePixel() const { return maGlobalSize; }
     159         122 :     void            SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; }
     160             : 
     161          46 :     const BitmapEx& GetBitmapEx() const { return maBitmapEx; }
     162           0 :     void            SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; }
     163             : 
     164           0 :     sal_uLong       GetLoopCount() const { return mnLoopCount; }
     165             :     void            SetLoopCount( const sal_uLong nLoopCount );
     166             :     void            ResetLoopCount();
     167             : 
     168             :     void            SetCycleMode( CycleMode eMode );
     169           0 :     CycleMode       GetCycleMode() const { return meCycleMode; }
     170             : 
     171           0 :     void            SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; }
     172           0 :     const Link&     GetNotifyHdl() const { return maNotifyLink; }
     173             : 
     174         846 :     size_t          Count() const { return maList.size(); }
     175             :     bool            Insert( const AnimationBitmap& rAnimationBitmap );
     176             :     const AnimationBitmap&
     177             :                     Get( sal_uInt16 nAnimation ) const;
     178             :     void            Replace( const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation );
     179             : 
     180             :     sal_uLong       GetSizeBytes() const;
     181             :     sal_uLong       GetChecksum() const;
     182             : 
     183             : public:
     184             : 
     185             :     bool            Convert( BmpConversion eConversion );
     186             :     bool            ReduceColors(
     187             :                         sal_uInt16 nNewColorCount,
     188             :                         BmpReduce eReduce = BMP_REDUCE_SIMPLE );
     189             : 
     190             :     bool            Invert();
     191             :     bool            Mirror( sal_uLong nMirrorFlags );
     192             :     bool            Adjust(
     193             :                         short nLuminancePercent = 0,
     194             :                         short nContrastPercent = 0,
     195             :                         short nChannelRPercent = 0,
     196             :                         short nChannelGPercent = 0,
     197             :                         short nChannelBPercent = 0,
     198             :                         double fGamma = 1.0,
     199             :                         bool bInvert = false );
     200             : 
     201             :     bool            Filter(
     202             :                         BmpFilter eFilter,
     203             :                         const BmpFilterParam* pFilterParam = NULL,
     204             :                         const Link* pProgress = NULL );
     205             : 
     206             :     friend VCL_DLLPUBLIC SvStream& ReadAnimation( SvStream& rIStream, Animation& rAnimation );
     207             :     friend VCL_DLLPUBLIC SvStream& WriteAnimation( SvStream& rOStream, const Animation& rAnimation );
     208             : 
     209             : public:
     210             : 
     211             :     SAL_DLLPRIVATE static void
     212           0 :                     ImplIncAnimCount() { mnAnimCount++; }
     213             :     SAL_DLLPRIVATE static void
     214           0 :                     ImplDecAnimCount() { mnAnimCount--; }
     215             :     SAL_DLLPRIVATE sal_uLong
     216           0 :                     ImplGetCurPos() const { return mnPos; }
     217             : 
     218             : private:
     219             :     SAL_DLLPRIVATE static sal_uLong mnAnimCount;
     220             : 
     221             :     AnimationBitmapList_impl maList;
     222             :     AnimViewList_impl maViewList;
     223             : 
     224             :     Link            maNotifyLink;
     225             :     BitmapEx        maBitmapEx;
     226             :     Timer           maTimer;
     227             :     Size            maGlobalSize;
     228             :     long            mnLoopCount;
     229             :     long            mnLoops;
     230             :     size_t          mnPos;
     231             :     CycleMode       meCycleMode;
     232             :     bool            mbIsInAnimation;
     233             :     bool            mbLoopTerminated;
     234             :     bool            mbIsWaiting;
     235             : 
     236             :     SAL_DLLPRIVATE void ImplRestartTimer( sal_uLong nTimeout );
     237             :     DECL_DLLPRIVATE_LINK( ImplTimeoutHdl, void* );
     238             : 
     239             : };
     240             : 
     241             : #endif // INCLUDED_VCL_ANIMATE_HXX
     242             : 
     243             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10