mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-17 23:11:48 +00:00
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:
parent
684b146867
commit
aa4ca4d9b3
|
@ -40,31 +40,31 @@ 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 );
|
||||||
|
|
||||||
|
QColor color = Qt::white;
|
||||||
|
if ( Okular::Settings::changeColors() )
|
||||||
|
{
|
||||||
|
switch ( Okular::Settings::renderMode() )
|
||||||
|
{
|
||||||
|
case Okular::Settings::EnumRenderMode::Inverted:
|
||||||
|
color = Qt::black;
|
||||||
|
break;
|
||||||
|
case Okular::Settings::EnumRenderMode::Paper:
|
||||||
|
color = Okular::Settings::paperColor();
|
||||||
|
break;
|
||||||
|
case Okular::Settings::EnumRenderMode::Recolor:
|
||||||
|
color = Okular::Settings::recolorBackground();
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
destPainter->fillRect( limits, color );
|
||||||
|
|
||||||
/** 1B - IF NO PIXMAP, DRAW EMPTY PAGE **/
|
/** 1B - IF NO PIXMAP, DRAW EMPTY PAGE **/
|
||||||
double pixmapRescaleRatio = pixmap ? scaledWidth / (double)pixmap->width() : -1;
|
double pixmapRescaleRatio = pixmap ? scaledWidth / (double)pixmap->width() : -1;
|
||||||
long pixmapPixels = pixmap ? (long)pixmap->width() * (long)pixmap->height() : 0;
|
long pixmapPixels = pixmap ? (long)pixmap->width() * (long)pixmap->height() : 0;
|
||||||
if ( !pixmap || pixmapRescaleRatio > 20.0 || pixmapRescaleRatio < 0.25 ||
|
if ( !pixmap || pixmapRescaleRatio > 20.0 || pixmapRescaleRatio < 0.25 ||
|
||||||
(scaledWidth != pixmap->width() && pixmapPixels > 6000000L) )
|
(scaledWidth != pixmap->width() && pixmapPixels > 6000000L) )
|
||||||
{
|
{
|
||||||
QColor color = Qt::white;
|
|
||||||
if ( Okular::Settings::changeColors() )
|
|
||||||
{
|
|
||||||
switch ( Okular::Settings::renderMode() )
|
|
||||||
{
|
|
||||||
case Okular::Settings::EnumRenderMode::Inverted:
|
|
||||||
color = Qt::black;
|
|
||||||
break;
|
|
||||||
case Okular::Settings::EnumRenderMode::Paper:
|
|
||||||
color = Okular::Settings::paperColor();
|
|
||||||
break;
|
|
||||||
case Okular::Settings::EnumRenderMode::Recolor:
|
|
||||||
color = Okular::Settings::recolorBackground();
|
|
||||||
break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
destPainter->fillRect( limits, color );
|
|
||||||
|
|
||||||
// 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() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue