blob: 6d93211dc39bf89099b81a97c9e4453470cdf25d (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#ifndef PAGECACHE_H
#define PAGECACHE_H
#include <QBrush>
#include <QHash>
#include <QPixmap>
#include <QRunnable>
#include <QThread>
class QPdfDocument;
class PageCache : public QThread
{
Q_OBJECT
public:
PageCache(QPdfDocument *doc, qreal zoom);
~PageCache();
QPixmap get(int page);
public slots:
void run();
signals:
void pageReady(int page);
protected:
Q_DECL_OVERRIDE void run();
private:
void insertPage(int page);
private:
QPdfDocument *m_doc;
QHash<int, QPixmap> m_pageCache;
qreal m_zoom;
int m_lastPageRequested;
QPixmap m_placeholderIcon;
QBrush m_placeholderBackground;
// performance statistics
qreal m_minRenderTime;
qreal m_maxRenderTime;
qreal m_totalRenderTime;
int m_totalPagesRendered;
};
#endif // PAGECACHE_H
|