LCOV - code coverage report
Current view: top level - svtools/source/graphic - grfcache.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 5 40.0 %
Date: 2015-06-13 12:38:46 Functions: 2 5 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_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
      21             : #define INCLUDED_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
      22             : 
      23             : #include <vcl/graph.hxx>
      24             : #include <vcl/timer.hxx>
      25             : #include <list>
      26             : 
      27             : 
      28             : // - GraphicManagerCache -
      29             : 
      30             : 
      31             : class GraphicAttr;
      32             : class GraphicCacheEntry;
      33             : class GraphicDisplayCacheEntry;
      34             : class GraphicObject;
      35             : 
      36             : class GraphicCache
      37             : {
      38             : private:
      39             :     typedef std::list< GraphicCacheEntry* > GraphicCacheEntryList;
      40             :     typedef std::list< GraphicDisplayCacheEntry* > GraphicDisplayCacheEntryList;
      41             : 
      42             :     Timer                   maReleaseTimer;
      43             :     GraphicCacheEntryList   maGraphicCache;
      44             :     GraphicDisplayCacheEntryList maDisplayCache;
      45             :     sal_uLong               mnReleaseTimeoutSeconds;
      46             :     sal_uLong               mnMaxDisplaySize;
      47             :     sal_uLong               mnMaxObjDisplaySize;
      48             :     sal_uLong               mnUsedDisplaySize;
      49             : 
      50             :     bool                ImplFreeDisplayCacheSpace( sal_uLong nSizeToFree );
      51             :     GraphicCacheEntry*      ImplGetCacheEntry( const GraphicObject& rObj );
      52             : 
      53             : 
      54             :                             DECL_LINK_TYPED( ReleaseTimeoutHdl, Timer* pTimer, void );
      55             : 
      56             : public:
      57             : 
      58             :                             GraphicCache(
      59             :                                 sal_uLong nDisplayCacheSize = 10000000UL,
      60             :                                 sal_uLong nMaxObjDisplayCacheSize = 2400000UL
      61             :                             );
      62             : 
      63             :                             ~GraphicCache();
      64             : 
      65             : public:
      66             : 
      67             :     void                    AddGraphicObject(
      68             :                                 const GraphicObject& rObj,
      69             :                                 Graphic& rSubstitute,
      70             :                                 const OString* pID,
      71             :                                 const GraphicObject* pCopyObj
      72             :                             );
      73             : 
      74             :     void                    ReleaseGraphicObject( const GraphicObject& rObj );
      75             : 
      76             :     void                    GraphicObjectWasSwappedOut( const GraphicObject& rObj );
      77             :     void                    GraphicObjectWasSwappedIn( const GraphicObject& rObj );
      78             : 
      79             :     OString            GetUniqueID( const GraphicObject& rObj ) const;
      80             : 
      81             : public:
      82             : 
      83             :     void                    SetMaxDisplayCacheSize( sal_uLong nNewCacheSize );
      84        4961 :     sal_uLong               GetMaxDisplayCacheSize() const { return mnMaxDisplaySize; };
      85             : 
      86             :     void                    SetMaxObjDisplayCacheSize(
      87             :                                 sal_uLong nNewMaxObjSize,
      88             :                                 bool bDestroyGreaterCached = false
      89             :                             );
      90             : 
      91           0 :     sal_uLong               GetMaxObjDisplayCacheSize() const { return mnMaxObjDisplaySize; }
      92             : 
      93           2 :     sal_uLong               GetUsedDisplayCacheSize() const { return mnUsedDisplaySize; }
      94           0 :     sal_uLong               GetFreeDisplayCacheSize() const { return( mnMaxDisplaySize - mnUsedDisplaySize ); }
      95             : 
      96             :     void                    SetCacheTimeout( sal_uLong nTimeoutSeconds );
      97           0 :     sal_uLong               GetCacheTimeout() const { return mnReleaseTimeoutSeconds; }
      98             : 
      99             :     bool                IsDisplayCacheable(
     100             :                                 OutputDevice* pOut,
     101             :                                 const Point& rPt,
     102             :                                 const Size& rSz,
     103             :                                 const GraphicObject& rObj,
     104             :                                 const GraphicAttr& rAttr
     105             :                             ) const;
     106             : 
     107             :     bool                IsInDisplayCache(
     108             :                                 OutputDevice* pOut,
     109             :                                 const Point& rPt,
     110             :                                 const Size& rSz,
     111             :                                 const GraphicObject& rObj,
     112             :                                 const GraphicAttr& rAttr
     113             :                             ) const;
     114             : 
     115             :     bool                CreateDisplayCacheObj(
     116             :                                 OutputDevice* pOut,
     117             :                                 const Point& rPt,
     118             :                                 const Size& rSz,
     119             :                                 const GraphicObject& rObj,
     120             :                                 const GraphicAttr& rAttr,
     121             :                                 const BitmapEx& rBmpEx
     122             :                             );
     123             : 
     124             :     bool                CreateDisplayCacheObj(
     125             :                                 OutputDevice* pOut,
     126             :                                 const Point& rPt,
     127             :                                 const Size& rSz,
     128             :                                 const GraphicObject& rObj,
     129             :                                 const GraphicAttr& rAttr,
     130             :                                 const GDIMetaFile& rMtf
     131             :                             );
     132             : 
     133             :     bool                DrawDisplayCacheObj(
     134             :                                 OutputDevice* pOut,
     135             :                                 const Point& rPt,
     136             :                                 const Size& rSz,
     137             :                                 const GraphicObject& rObj,
     138             :                                 const GraphicAttr& rAttr
     139             :                             );
     140             : };
     141             : 
     142             : #endif // INCLUDED_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
     143             : 
     144             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11