LibreOffice Module canvas (master) 1
ogl_texturecache.hxx
Go to the documentation of this file.
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#pragma once
11
12#include <sal/types.h>
13#include <unordered_map>
14
15namespace com::sun::star::geometry { struct IntegerSize2D; }
16
17
18namespace oglcanvas
19{
21 {
22 public:
25
27 void flush();
28
36 void prune();
37
39 size_t getCacheSize() const { return maCache.size(); };
40 sal_uInt32 getCacheMissCount() const { return mnMissCount; }
41 sal_uInt32 getCacheHitCount() const { return mnHitCount; }
42
43 unsigned int getTexture( const css::geometry::IntegerSize2D& rPixelSize,
44 const sal_Int8* pPixel,
45 sal_uInt32 nPixelCrc32) const;
46 private:
48 {
49 CacheEntry() : nTexture(0), bOld(false) {}
50 unsigned int nTexture;
51 bool bOld;
52 };
53 typedef std::unordered_map<sal_uInt32,CacheEntry> TextureCacheMapT;
55 mutable sal_uInt32 mnMissCount;
56 mutable sal_uInt32 mnHitCount;
57 };
58}
59
60/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt32 getCacheHitCount() const
sal_uInt32 getCacheMissCount() const
size_t getCacheSize() const
Statistics.
std::unordered_map< sal_uInt32, CacheEntry > TextureCacheMapT
void prune()
prune old entries from cache
unsigned int getTexture(const css::geometry::IntegerSize2D &rPixelSize, const sal_Int8 *pPixel, sal_uInt32 nPixelCrc32) const
void flush()
clear whole cache, reset statistic counters
signed char sal_Int8