TextureCache.h 502 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#ifndef TEXTURECACHE_H
#define TEXTURECACHE_H

#include <QVector>

#include "Texture.h"
#include "WebImageCache.h"

class TextureCache
{
public:
    explicit TextureCache(uint32_t cacheSize);

    TexturePtr get(const QString& tileURL);

    void sync(void);

private:
    QPair<TexturePtr, int32_t> lookup(const QString& tileURL);

    bool requireSync(void) const;

    uint32_t cacheSize;
    QVector<TexturePtr> textures;

    QScopedPointer<WebImageCache> imageCache;
};

#endif // TEXTURECACHE_H