Commit 6cab02b5 authored by Claudio Valerio's avatar Claudio Valerio

Merge branch 'master' of github.com:Sankore/Sankore-3.1

parents 1e25ccf9 7d461a6d
...@@ -28,6 +28,8 @@ XPDFRenderer::XPDFRenderer(const QString &filename) ...@@ -28,6 +28,8 @@ XPDFRenderer::XPDFRenderer(const QString &filename)
mPagesMap.clear(); mPagesMap.clear();
mThumbs.clear(); mThumbs.clear();
mThumbMap.clear(); mThumbMap.clear();
mScaleX = 0.0;
mScaleY = 0.0;
} }
XPDFRenderer::~XPDFRenderer() XPDFRenderer::~XPDFRenderer()
...@@ -122,11 +124,21 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds) ...@@ -122,11 +124,21 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
{ {
if (isValid()) if (isValid())
{ {
qreal xscale = p->worldTransform().m11();
qreal yscale = p->worldTransform().m22();
bool bZoomChanged = false;
if(mScaleX != xscale || mScaleY != yscale)
{
mScaleX = xscale;
mScaleY = yscale;
bZoomChanged = true;
}
// First verify if the thumbnails and the pages are generated // First verify if the thumbnails and the pages are generated
if(!bThumbGenerated) if(!bThumbGenerated)
{ {
qreal xscale = p->worldTransform().m11();
qreal yscale = p->worldTransform().m22();
if(!mThumbMap[pageNumber - 1]) if(!mThumbMap[pageNumber - 1])
{ {
// Generate the thumbnail // Generate the thumbnail
...@@ -138,11 +150,9 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds) ...@@ -138,11 +150,9 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
} }
} }
} }
else if(!bPagesGenerated) else if(!bPagesGenerated || bZoomChanged)
{ {
qreal xscale = p->worldTransform().m11(); if(!mPagesMap[pageNumber - 1] || bZoomChanged)
qreal yscale = p->worldTransform().m22();
if(!mPagesMap[pageNumber - 1])
{ {
// Generate the page // Generate the page
mNumPageToPageMap[pageNumber] = *createPDFImage(pageNumber, xscale, yscale, bounds); mNumPageToPageMap[pageNumber] = *createPDFImage(pageNumber, xscale, yscale, bounds);
......
...@@ -49,6 +49,8 @@ class XPDFRenderer : public PDFRenderer ...@@ -49,6 +49,8 @@ class XPDFRenderer : public PDFRenderer
bool bPagesGenerated; bool bPagesGenerated;
SplashBitmap* mpSplashBitmap; SplashBitmap* mpSplashBitmap;
SplashOutputDev* mSplash; SplashOutputDev* mSplash;
qreal mScaleX;
qreal mScaleY;
}; };
#endif // XPDFRENDERER_H #endif // XPDFRENDERER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment