LCOV - code coverage report
Current view: top level - canvas/source/opengl - ogl_texturecache.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 4 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             : 
      10             : #ifndef INCLUDED_CANVAS_SOURCE_OPENGL_OGL_TEXTURECACHE_HXX
      11             : #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_TEXTURECACHE_HXX
      12             : 
      13             : #include <sal/types.h>
      14             : #include <boost/unordered_map.hpp>
      15             : 
      16             : namespace com { namespace sun { namespace star {
      17             :     namespace geometry { struct IntegerSize2D; }
      18             : }}}
      19             : 
      20             : namespace oglcanvas
      21             : {
      22             :     class TextureCache
      23             :     {
      24             :     public:
      25             :         TextureCache();
      26             :         ~TextureCache();
      27             : 
      28             :         /// clear whole cache, reset statistic counters
      29             :         void flush();
      30             : 
      31             :         /** prune old entries from cache
      32             : 
      33             :             Everytime this method is called, all cache entries are set
      34             :             to "old". If subsequently not used by getTexture(),
      35             :             they'll be entitled for expunge on the next prune()
      36             :             call. Resets statistic counters.
      37             :          */
      38             :         void prune();
      39             : 
      40             :         /// Statistics
      41           0 :         size_t getCacheSize() const { return maCache.size(); };
      42           0 :         sal_uInt32 getCacheMissCount() const { return mnMissCount; }
      43           0 :         sal_uInt32 getCacheHitCount() const { return mnHitCount; }
      44             : 
      45             :         unsigned int getTexture( const ::com::sun::star::geometry::IntegerSize2D& rPixelSize,
      46             :                                  const sal_Int8*                                  pPixel,
      47             :                                  sal_uInt32                                       nPixelCrc32) const;
      48             :     private:
      49             :         struct CacheEntry
      50             :         {
      51           0 :             CacheEntry() : nTexture(0), bOld(false) {}
      52             :             unsigned int nTexture;
      53             :             bool bOld;
      54             :         };
      55             :         typedef boost::unordered_map<sal_uInt32,CacheEntry> TextureCacheMapT;
      56             :         mutable TextureCacheMapT maCache;
      57             :         mutable sal_uInt32       mnMissCount;
      58             :         mutable sal_uInt32       mnHitCount;
      59             :     };
      60             : }
      61             : 
      62             : #endif
      63             : 
      64             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10