|
|
@ -127,8 +127,9 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds) |
|
|
|
qreal xscale = p->worldTransform().m11(); |
|
|
|
qreal xscale = p->worldTransform().m11(); |
|
|
|
qreal yscale = p->worldTransform().m22(); |
|
|
|
qreal yscale = p->worldTransform().m22(); |
|
|
|
bool bZoomChanged = false; |
|
|
|
bool bZoomChanged = false; |
|
|
|
|
|
|
|
bool bFirstThumbnail = false; |
|
|
|
|
|
|
|
|
|
|
|
if(mScaleX != xscale || mScaleY != yscale) |
|
|
|
if(fabs(mScaleX - xscale) > 0.1 || fabs(mScaleY - yscale) > 0.1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mScaleX = xscale; |
|
|
|
mScaleX = xscale; |
|
|
|
mScaleY = yscale; |
|
|
|
mScaleY = yscale; |
|
|
@ -138,9 +139,14 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds) |
|
|
|
// First verify if the thumbnails and the pages are generated
|
|
|
|
// First verify if the thumbnails and the pages are generated
|
|
|
|
if(!bThumbGenerated) |
|
|
|
if(!bThumbGenerated) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(pageNumber == 1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
bFirstThumbnail = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!mThumbMap[pageNumber - 1]) |
|
|
|
if(!mThumbMap[pageNumber - 1]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
// Generate the thumbnail
|
|
|
|
// Generate the thumbnail
|
|
|
|
mThumbs << *createPDFImage(pageNumber, xscale, yscale, bounds); |
|
|
|
mThumbs << *createPDFImage(pageNumber, xscale, yscale, bounds); |
|
|
|
mThumbMap[pageNumber - 1] = true; |
|
|
|
mThumbMap[pageNumber - 1] = true; |
|
|
@ -164,10 +170,9 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Warning: verify pagenumber
|
|
|
|
|
|
|
|
QImage pdfImage; |
|
|
|
QImage pdfImage; |
|
|
|
|
|
|
|
|
|
|
|
if(!bThumbGenerated) |
|
|
|
if(!bThumbGenerated || bFirstThumbnail) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pdfImage = mThumbs.at(pageNumber - 1); |
|
|
|
pdfImage = mThumbs.at(pageNumber - 1); |
|
|
|
} |
|
|
|
} |
|
|
@ -176,8 +181,6 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds) |
|
|
|
pdfImage = mNumPageToPageMap[pageNumber]; |
|
|
|
pdfImage = mNumPageToPageMap[pageNumber]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pdfImage.rect(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QTransform savedTransform = p->worldTransform(); |
|
|
|
QTransform savedTransform = p->worldTransform(); |
|
|
|
p->resetTransform(); |
|
|
|
p->resetTransform(); |
|
|
|
p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), pdfImage); |
|
|
|
p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), pdfImage); |
|
|
|