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

Generated by: LCOV version 1.11