3
Copyright 2014 Adam Reichold
5
This file is part of qpdfview.
7
qpdfview is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 2 of the License, or
10
(at your option) any later version.
12
qpdfview is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with qpdfview. If not, see <http://www.gnu.org/licenses/>.
38
class TileItem : public QObject
43
TileItem(QObject* parent = 0);
46
inline const QRect& rect() const { return m_rect; }
47
inline void setRect(const QRect& rect) { m_rect = rect; }
49
inline const QRectF& cropRect() const { return m_cropRect; }
50
void setCropRect(const QRectF& cropRect);
52
inline void dropPixmap() { m_pixmap = QPixmap(); }
53
inline void dropObsoletePixmap() { m_obsoletePixmap = QPixmap(); }
55
static void dropCachedPixmaps(PageItem* page);
57
void paint(QPainter* painter, const QPointF& topLeft);
60
void refresh(bool keepObsoletePixmaps = false);
62
int startRender(bool prefetch = false);
65
void deleteAfterRender();
68
void on_renderTask_finished();
69
void on_renderTask_imageReady(const RenderParam& renderParam,
70
const QRect& rect, bool prefetch,
71
QImage image, QRectF cropRect);
74
Q_DISABLE_COPY(TileItem)
76
static Settings* s_settings;
78
typedef QPair< PageItem*, QByteArray > CacheKey;
79
typedef QPair< QPixmap, QRectF > CacheObject;
81
static QCache< CacheKey, CacheObject > s_cache;
83
PageItem* parentPage() const;
84
CacheKey cacheKey() const;
91
QPixmap m_obsoletePixmap;
95
RenderTask* m_renderTask;