always fill the page with the paper color, so page pixmaps with alpha does not cause garbage to be left on the page

svn path=/trunk/KDE/kdegraphics/okular/; revision=715954
This commit is contained in:
Pino Toscano 2007-09-23 15:30:31 +00:00
parent 684b146867
commit aa4ca4d9b3

View file

@ -40,12 +40,6 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const Okular::Page
/** 1 - RETRIEVE THE 'PAGE+ID' PIXMAP OR A SIMILAR 'PAGE' ONE **/ /** 1 - RETRIEVE THE 'PAGE+ID' PIXMAP OR A SIMILAR 'PAGE' ONE **/
const QPixmap * pixmap = page->_o_nearestPixmap( pixID, scaledWidth, scaledHeight ); const QPixmap * pixmap = page->_o_nearestPixmap( pixID, scaledWidth, scaledHeight );
/** 1B - IF NO PIXMAP, DRAW EMPTY PAGE **/
double pixmapRescaleRatio = pixmap ? scaledWidth / (double)pixmap->width() : -1;
long pixmapPixels = pixmap ? (long)pixmap->width() * (long)pixmap->height() : 0;
if ( !pixmap || pixmapRescaleRatio > 20.0 || pixmapRescaleRatio < 0.25 ||
(scaledWidth != pixmap->width() && pixmapPixels > 6000000L) )
{
QColor color = Qt::white; QColor color = Qt::white;
if ( Okular::Settings::changeColors() ) if ( Okular::Settings::changeColors() )
{ {
@ -65,6 +59,12 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const Okular::Page
} }
destPainter->fillRect( limits, color ); destPainter->fillRect( limits, color );
/** 1B - IF NO PIXMAP, DRAW EMPTY PAGE **/
double pixmapRescaleRatio = pixmap ? scaledWidth / (double)pixmap->width() : -1;
long pixmapPixels = pixmap ? (long)pixmap->width() * (long)pixmap->height() : 0;
if ( !pixmap || pixmapRescaleRatio > 20.0 || pixmapRescaleRatio < 0.25 ||
(scaledWidth != pixmap->width() && pixmapPixels > 6000000L) )
{
// draw something on the blank page: the okular icon or a cross (as a fallback) // draw something on the blank page: the okular icon or a cross (as a fallback)
if ( !busyPixmap->isNull() ) if ( !busyPixmap->isNull() )
{ {