Fixed a zoom factor issue related to the PDF display on the board

preferencesAboutTextFull
shibakaneki 14 years ago
parent 061d823db0
commit 7d461a6d71
  1. 22
      src/pdf/XPDFRenderer.cpp
  2. 2
      src/pdf/XPDFRenderer.h

@ -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)
{ {
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)
} }
} }
} }
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
bool bPagesGenerated; bool bPagesGenerated;
SplashBitmap* mpSplashBitmap; SplashBitmap* mpSplashBitmap;
SplashOutputDev* mSplash; SplashOutputDev* mSplash;
qreal mScaleX;
qreal mScaleY;
}; };
#endif // XPDFRENDERER_H #endif // XPDFRENDERER_H

Loading…
Cancel
Save