Commit 93c1d384 authored by Enrico Ros's avatar Enrico Ros

Implemented history (implementation is inside Document. actions (2) are in

 Part). Implemented 'history (xpdf's LinkAction) links'. History depth is
 100 steps by default (this is enough for sure, clicking 100 times on a
 button is not an easy task :-).

Minor issues (removed half TODOs in code, all FIXMEs are already removed):
Invoke mailer on 'mailto:' links inst instead of konqueror.
Actions cleanup: disable actions like 'print', 'preview', 'save to..', etc
 when there isn't an active document. Added history actions to the toolbar
 in place of the 'prev_page' and 'next_page' ones. Fixed open+open_recent
 action tooltip and behavior.
Move definition and implementation of PagePainter class to ui/pagepainter
 from core/page.
Valgrinded and leakchecked (2 memory leaks spotted and fixed (missing
 contents deletion in KPDFGeneratorThread and missing deletion of
 PixmapRequests on cancel in Document::requestPixmaps())).

svn path=/trunk/kdegraphics/kpdf/; revision=382960
parent e65c7058
......@@ -6,16 +6,13 @@ Legend:
MRG - MeRGed (code from a branch or a patch)
Status:
-> 2005-01-20: Stable. Apart from a bad memory deallocation mechanism
the core is ready for a public release. Usability: needs testing.
next steps: empty the in-progress list and keep it empty until release.
-> 2005-01-27: Stable and leakchecked. Usability: needs testing.
-> 2005-01-20: Stable. Apart from a bad (but still safe) memory deallocation
mechanism the core is ready for a public release.
In progress:
In progress 3.4 features (deadline is 2k5-Feb-2):
-> save/restore history (partially committed)
-> new word highlighting for searches / other highlights
-> implement history (for actionNamed and restoring previous viewports on navigation)
High priority 3.4 features (deadline is 2k5-Feb-2):
- empty! -
More items (first items will enter 'In progress list' first):
-> go to next/previous bookmark actions (showing in thumbnailslist rmb popup too)
......@@ -28,9 +25,8 @@ More items (first items will enter 'In progress list' first):
-> show Viewport in ThumbnailsList (blended/contour)
-> history as a toolbox child (collecting Doc's viewport changes notifications)
-> Delay TOC (DocumentSynapsis) generation (and move it on thread)
-> refactor ThumbnailsList to do internal rendering as pageview does (way
faster than using QScrollView + inserted Widgets and saves 8% on document
loading)
-> refactor ThumbnailsList to do internal rendering as pageview does (way faster
than using QScrollView + inserted Widgets and saves 8% on document loading)
-> move toolbar view actions in the PageView instead of the part. maybe.. or not...
-> usability: layout 2PPV [1 2,3 4,5 6] -> [1,2 3,4 5]. add option for 'ebook' style alignment
-> usability: trigger redraw on 'filter text' on current page
......@@ -69,7 +65,7 @@ More items (first items will enter 'In progress list' first):
-> core: pdf forms support
-> add OCR for building TextPages out of pure graphical (aka scanned) pages
-> rotate the whole document / individual pages
-> presentation: implement transitions (6/11 done)
-> presentation: implement missing transitions (6/11 done)
-> presentation: add some gfx tools (like a red pencil)
-> presentation: save a flag (to the xml) to open a pdf in presentation mode
-> presentation: link following (difficult due to pagerects related to pageview pixmap only)
......@@ -85,6 +81,8 @@ More items (first items will enter 'In progress list' first):
-> export: export to other formats keeping formatting (a dream.. except for PNG :-) (PS is easy, we just have PSOutputDev that does it :-D)
Done (newest features come first):
-> FIX: complete valgrind check and leakfix (2 leaks were present) [27-Jan-04]
-> ADD: history (100 steps) and forward/back actions
-> ADD: rmb popup on thumbnailslist (the popup shared with pageView: same behavior)
-> ADD: display 'current page' / 'total pages' with analog indicator, active labels, etc
-> CHG: Presentation mode is now Ctrl+Shift+p instead of F9 because it was colliding with Konqueror's toggle sidebar
......
......@@ -47,10 +47,13 @@ class KPDFDocumentPrivate
bool filterCase;
// cached stuff
DocumentViewport viewport;
QString docFileName;
QString xmlFileName;
// viewport stuff
QValueList< DocumentViewport > viewportHistory;
QValueList< DocumentViewport >::iterator viewportIterator;
// observers / requests / allocator stuff
QMap< int, DocumentObserver * > observers;
QValueList< PixmapRequest * > pixmapRequestsStack;
......@@ -144,12 +147,12 @@ bool KPDFDocument::openDocument( const QString & docFile )
// 3. setup observers inernal lists and data
processPageList( true );
// 4. set initial page (restoring previous page saved in xml)
DocumentViewport loadedViewport = d->viewport;
if ( loadedViewport.pageNumber < 0 )
loadedViewport.pageNumber = 0;
// 4. set initial page (restoring the page saved in xml if loaded)
DocumentViewport loadedViewport = (*d->viewportIterator);
if ( loadedViewport.pageNumber != -1 )
(*d->viewportIterator) = DocumentViewport();
else
d->viewport = DocumentViewport();
loadedViewport.pageNumber = 0;
setViewport( loadedViewport );
// start bookmark saver timer
......@@ -212,7 +215,9 @@ void KPDFDocument::closeDocument()
d->allocatedPixmapsFifo.clear();
// reset internal variables
d->viewport = DocumentViewport();
d->viewportHistory.clear();
d->viewportHistory.append( DocumentViewport() );
d->viewportIterator = d->viewportHistory.begin();
d->searchPage = -1;
d->allocatedPixmapsTotalMemory = 0;
}
......@@ -295,12 +300,12 @@ const KPDFPage * KPDFDocument::page( uint n ) const
const DocumentViewport & KPDFDocument::viewport() const
{
return d->viewport;
return (*d->viewportIterator);
}
uint KPDFDocument::currentPage() const
{
return d->viewport.pageNumber;
return (*d->viewportIterator).pageNumber;
}
uint KPDFDocument::pages() const
......@@ -313,6 +318,16 @@ bool KPDFDocument::okToPrint() const
return generator ? generator->isAllowed( Generator::Print ) : false;
}
bool KPDFDocument::historyAtBegin() const
{
return d->viewportIterator == d->viewportHistory.begin();
}
bool KPDFDocument::historyAtEnd() const
{
return d->viewportIterator == --(d->viewportHistory.end());
}
QString KPDFDocument::getMetaData( const QString & key, const QString & option ) const
{
return generator ? generator->getMetaData( key, option ) : QString();
......@@ -320,8 +335,15 @@ QString KPDFDocument::getMetaData( const QString & key, const QString & option )
void KPDFDocument::requestPixmaps( const QValueList< PixmapRequest * > & requests )
{
if ( !generator || requests.isEmpty() )
if ( !generator )
{
// delete requests..
QValueList< PixmapRequest * >::const_iterator rIt = requests.begin(), rEnd = requests.end();
for ( ; rIt != rEnd; ++rIt )
delete *rIt;
// ..and return
return;
}
// 1. [CLEAN STACK] remove previous requests of requesterID
int requesterID = requests.first()->id;
......@@ -329,7 +351,11 @@ void KPDFDocument::requestPixmaps( const QValueList< PixmapRequest * > & request
while ( sIt != sEnd )
{
if ( (*sIt)->id == requesterID )
{
// delete request and remove it from stack
delete *sIt;
sIt = d->pixmapRequestsStack.remove( sIt );
}
else
++sIt;
}
......@@ -342,7 +368,11 @@ void KPDFDocument::requestPixmaps( const QValueList< PixmapRequest * > & request
// set the 'page field' (see PixmapRequest) and check if it is valid
PixmapRequest * request = *rIt;
if ( !(request->page = pages_vector[ request->pageNumber ]) )
{
// skip requests referencing an invalid page (must not happen)
delete request;
continue;
}
if ( !request->async )
request->priority = 0;
......@@ -386,18 +416,18 @@ void KPDFDocument::requestTextPage( uint page )
void KPDFDocument::setNextPage()
{
// advance page and set viewport on observers
if ( d->viewport.pageNumber < (int)pages_vector.count() - 1 )
setViewport( DocumentViewport( d->viewport.pageNumber + 1 ) );
if ( (*d->viewportIterator).pageNumber < (int)pages_vector.count() - 1 )
setViewport( DocumentViewport( (*d->viewportIterator).pageNumber + 1 ) );
}
void KPDFDocument::setPrevPage()
{
// go to previous page and set viewport on observers
if ( d->viewport.pageNumber > 0 )
setViewport( DocumentViewport( d->viewport.pageNumber - 1 ) );
if ( (*d->viewportIterator).pageNumber > 0 )
setViewport( DocumentViewport( (*d->viewportIterator).pageNumber - 1 ) );
}
*/
void KPDFDocument::setViewportPage( int page, int id )
void KPDFDocument::setViewportPage( int page, int excludeId )
{
// clamp page in range [0 ... numPages-1]
if ( page < 0 )
......@@ -406,22 +436,39 @@ void KPDFDocument::setViewportPage( int page, int id )
page = pages_vector.count() - 1;
// make a viewport from the page and broadcast it
setViewport( DocumentViewport( page ), id );
setViewport( DocumentViewport( page ), excludeId );
}
void KPDFDocument::setViewport( const DocumentViewport & viewport, int id )
void KPDFDocument::setViewport( const DocumentViewport & viewport, int excludeId )
{
// if already broadcasted, don't redo it
if ( viewport == d->viewport )
DocumentViewport & oldViewport = *d->viewportIterator;
if ( viewport == oldViewport )
kdDebug() << "setViewport with the same viewport." << endl;
// set internal viewport
d->viewport = viewport;
// set internal viewport taking care of history
if ( oldViewport.pageNumber == viewport.pageNumber || oldViewport.pageNumber == -1 )
{
// if page is unchanged save the viewport at current position in queue
oldViewport = viewport;
}
else
{
// remove elements after viewportIterator in queue
d->viewportHistory.erase( ++d->viewportIterator, d->viewportHistory.end() );
// keep the list to a reasonable size by removing head when needed
if ( d->viewportHistory.count() >= 100 )
d->viewportHistory.pop_front();
// add the item at the end of the queue
d->viewportIterator = d->viewportHistory.append( viewport );
}
// notify change to all other (different from id) viewports
// notify change to all other (different from id) observers
QMap< int, DocumentObserver * >::iterator it = d->observers.begin(), end = d->observers.end();
for ( ; it != end ; ++ it )
if ( it.key() != id )
if ( it.key() != excludeId )
(*it)->notifyViewportChanged();
// [MEM] raise position of currently viewed page in allocation queue
......@@ -446,6 +493,30 @@ void KPDFDocument::setViewport( const DocumentViewport & viewport, int id )
}
}
void KPDFDocument::setPrevViewport()
// restore viewport from the history
{
if ( d->viewportIterator != d->viewportHistory.begin() )
{
// restore previous viewport and notify it to observers
--d->viewportIterator;
foreachObserver( notifyViewportChanged() );
}
}
void KPDFDocument::setNextViewport()
// restore next viewport from the history
{
QValueList< DocumentViewport >::iterator nextIterator = d->viewportIterator;
++nextIterator;
if ( nextIterator != d->viewportHistory.end() )
{
// restore next viewport and notify it to observers
++d->viewportIterator;
foreachObserver( notifyViewportChanged() );
}
}
bool KPDFDocument::findText( const QString & string, bool keepCase, bool findAhead )
{
// turn selection drawing off on filtered pages
......@@ -460,7 +531,7 @@ bool KPDFDocument::findText( const QString & string, bool keepCase, bool findAhe
}
// continue checking last SearchPage first (if it is the current page)
int currentPage = d->viewport.pageNumber;
int currentPage = (*d->viewportIterator).pageNumber;
int pageCount = pages_vector.count();
KPDFPage * foundPage = 0,
* lastPage = (d->searchPage > -1) ? pages_vector[ d->searchPage ] : 0;
......@@ -622,21 +693,21 @@ void KPDFDocument::processLink( const KPDFLink * link )
setViewportPage( 0 );
break;
case KPDFLinkAction::PagePrev:
if ( d->viewport.pageNumber > 0 )
setViewportPage( d->viewport.pageNumber - 1 );
if ( (*d->viewportIterator).pageNumber > 0 )
setViewportPage( (*d->viewportIterator).pageNumber - 1 );
break;
case KPDFLinkAction::PageNext:
if ( d->viewport.pageNumber < (int)pages_vector.count() - 1 )
setViewportPage( d->viewport.pageNumber + 1 );
if ( (*d->viewportIterator).pageNumber < (int)pages_vector.count() - 1 )
setViewportPage( (*d->viewportIterator).pageNumber + 1 );
break;
case KPDFLinkAction::PageLast:
setViewportPage( pages_vector.count() - 1 );
break;
case KPDFLinkAction::HistoryBack:
{} //TODO
setPrevViewport();
break;
case KPDFLinkAction::HistoryForward:
{} //TODO
setNextViewport();
break;
case KPDFLinkAction::Quit:
kapp->quit();
......@@ -652,17 +723,23 @@ void KPDFDocument::processLink( const KPDFLink * link )
case KPDFLink::Browse: {
const KPDFLinkBrowse * browse = static_cast< const KPDFLinkBrowse * >( link );
// get service for web browsing TODO: check for "mailto:" links
// if the url is a mailto one, invoke mailer
if ( browse->url().startsWith( "mailto:", false ) )
kapp->invokeMailer( browse->url() );
else
{
// get service for web browsing
KService::Ptr ptr = KServiceTypeProfile::preferredService("text/html", "Application");
KURL::List lst;
// append 'url' parameter to the service and run it
lst.append( browse->url() );
KRun::run( *ptr, lst );
}
} break;
case KPDFLink::Movie:
//const KPDFLinkMovie * browse = static_cast< const KPDFLinkMovie * >( link );
// TODO this
// TODO this (Movie link)
break;
}
}
......@@ -738,7 +815,7 @@ void KPDFDocument::sendGeneratorRequest()
generator->generatePixmap( request );
}
void KPDFDocument::cleanupPixmapMemory( int /*bytesOffset*/ )
void KPDFDocument::cleanupPixmapMemory( int /*sure? bytesOffset*/ )
{
// [MEM] choose memory parameters based on configuration profile
int clipValue = -1;
......@@ -901,7 +978,7 @@ void KPDFDocument::loadDocumentInfo()
if ( infoElement.tagName() == "activePage" )
{
if ( infoElement.hasAttribute( "viewport" ) )
d->viewport = DocumentViewport( infoElement.attribute( "viewport" ) );
*d->viewportIterator = DocumentViewport( infoElement.attribute( "viewport" ) );
}
infoNode = infoNode.nextSibling();
}
......@@ -984,7 +1061,6 @@ void KPDFDocument::saveDocumentInfo() const
if ( d->docFileName.isNull() )
return;
//kdDebug() << "Using '" << d->xmlFileName << "' as document info file for saving." << endl;
QFile infoFile( d->xmlFileName );
if (infoFile.open( IO_WriteOnly | IO_Truncate) )
{
......@@ -1012,10 +1088,21 @@ void KPDFDocument::saveDocumentInfo() const
QDomElement generalInfo = doc.createElement( "generalInfo" );
root.appendChild( generalInfo );
// <general info><activePage />
QDomElement activePage = doc.createElement( "activePage" );
activePage.setAttribute( "viewport", d->viewport.toString() );
activePage.setAttribute( "viewport", (*d->viewportIterator).toString() );
generalInfo.appendChild( activePage );
/*
// <general info><history> ... </history>
QDomElement historyNode = doc.createElement( "history" );
generalInfo.appendChild( historyNode );
for ( uint i = 0; i < 6 ; i++ )
{
QDomElement historyEntry = doc.createElement( "entry" );
historyEntry.setAttribute( "viewport", DocumentViewport().toString() );
historyNode.appendChild( historyEntry );
}
*/
// Save DOM to XML file
QString xml = doc.toString();
QTextStream os( &infoFile );
......
......@@ -68,11 +68,15 @@ class KPDFDocument : public QObject // only for a private slot..
uint currentPage() const;
uint pages() const;
bool okToPrint() const;
bool historyAtBegin() const;
bool historyAtEnd() const;
QString getMetaData( const QString & key, const QString & option = QString() ) const;
// perform actions on document / pages
void setViewportPage( int page, int id = -1 );
void setViewport( const DocumentViewport & viewport, int id = -1 );
void setViewportPage( int page, int excludeId = -1 );
void setViewport( const DocumentViewport & viewport, int excludeId = -1 );
void setPrevViewport();
void setNextViewport();
void requestPixmaps( const QValueList< PixmapRequest * > & requests );
void requestTextPage( uint page );
bool findText( const QString & text = "", bool caseSensitive = false, bool findAhead = false );
......
......@@ -22,6 +22,7 @@
// xpdf includes
#include "xpdf/PSOutputDev.h"
#include "xpdf/TextOutputDev.h"
#include "xpdf/Link.h"
#include "xpdf/ErrorCodes.h"
#include "xpdf/UnicodeMap.h"
......@@ -285,7 +286,6 @@ void PDFGenerator::generateSyncTextPage( KPDFPage * page )
bool PDFGenerator::print( KPrinter& printer )
{
//FIXME (if needed) TAKE CARE OF THREADING, READY STATE AND SIMILAR STUFF
KTempFile tf( QString::null, ".ps" );
PSOutputDev *psOut = new PSOutputDev(tf.name().latin1(), pdfdoc->getXRef(), pdfdoc->getCatalog(), 1, pdfdoc->getNumPages(), psModePS);
......@@ -532,7 +532,7 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, GList * items )
pageNumber = pdfdoc->findPage( ref.num, ref.gen ) - 1;
}
// set page as attribute to node
// TODO add other attributes to the viewport
// TODO add other attributes to the viewport (taken from link)
item.setAttribute( "Viewport", DocumentViewport( pageNumber ).toString() );
}
}
......@@ -690,6 +690,7 @@ struct PPGThreadPrivate
QImage * m_image;
TextPage * m_textPage;
QValueList< KPDFPageRect * > m_rects;
bool m_rectsTaken;
};
PDFPixmapGeneratorThread::PDFPixmapGeneratorThread( PDFGenerator * gen )
......@@ -697,10 +698,24 @@ PDFPixmapGeneratorThread::PDFPixmapGeneratorThread( PDFGenerator * gen )
{
d->generator = gen;
d->currentRequest = 0;
d->m_image = 0;
d->m_textPage = 0;
d->m_rectsTaken = true;
}
PDFPixmapGeneratorThread::~PDFPixmapGeneratorThread()
{
// delete internal objects if the class is deleted before the gui thread
// takes the data
delete d->m_image;
delete d->m_textPage;
if ( !d->m_rectsTaken && d->m_rects.count() )
{
QValueList< KPDFPageRect * >::iterator it = d->m_rects.begin(), end = d->m_rects.end();
for ( ; it != end; ++it )
delete *it;
}
// delete internal storage structure
delete d;
}
......@@ -727,9 +742,7 @@ void PDFPixmapGeneratorThread::startGeneration( PixmapRequest * request )
#endif
// set generation parameters and run thread
d->currentRequest = request;
// TODO map priorities embedded in request
QThread::Priority prio = QThread::InheritPriority;
start( prio );
start( QThread::InheritPriority );
}
void PDFPixmapGeneratorThread::endGeneration()
......@@ -749,16 +762,21 @@ void PDFPixmapGeneratorThread::endGeneration()
QImage * PDFPixmapGeneratorThread::takeImage() const
{
return d->m_image;
QImage * img = d->m_image;
d->m_image = 0;
return img;
}
TextPage * PDFPixmapGeneratorThread::takeTextPage() const
{
return d->m_textPage;
TextPage * tp = d->m_textPage;
d->m_textPage = 0;
return tp;
}
QValueList< KPDFPageRect * > PDFPixmapGeneratorThread::takeRects() const
{
d->m_rectsTaken = true;
return d->m_rects;
}
......@@ -792,9 +810,16 @@ void PDFPixmapGeneratorThread::run()
fakeDpiX, fakeDpiY, 0, true, genPageRects );
// 2. grab data from the OutputDev and store it locally (note takeIMAGE)
#ifndef NDEBUG
if ( d->m_image )
kdDebug() << "PDFPixmapGeneratorThread: previous image not taken" << endl;
if ( d->m_textPage )
kdDebug() << "PDFPixmapGeneratorThread: previous textpage not taken" << endl;
#endif
d->m_image = d->generator->kpdfOutputDev->takeImage();
d->m_textPage = d->generator->kpdfOutputDev->takeTextPage();
d->m_rects = d->generator->kpdfOutputDev->takeRects();
d->m_rectsTaken = false;
// 3. [UNLOCK] mutex
d->generator->docLock.unlock();
......
......@@ -324,7 +324,7 @@ KPDFLink * KPDFOutputDev::generateLink( LinkAction * a )
break;
case actionMovie:
/* { TODO this
/* { TODO this (Movie link)
m_type = Movie;
LinkMovie * m = (LinkMovie *) a;
// copy Movie parameters (2 IDs and a const char *)
......@@ -364,7 +364,8 @@ DocumentViewport KPDFOutputDev::decodeViewport( GString * namedDest, LinkDest *
vp.pageNumber = m_doc->findPage( ref.num, ref.gen ) - 1;
}
// get destination position (fill remaining Viewport fields)
// get destination position
// TODO add other attributes to the viewport (taken from link)
switch ( dest->getKind() )
{
case destXYZ:
......
......@@ -103,7 +103,7 @@ class KPDFLinkAction : public KPDFLink
/** Movie: Not yet defined -> think renaming to 'Media' link **/
class KPDFLinkMovie : public KPDFLink
//TODO: this
// TODO this (Movie link)
{
public:
KPDFLinkMovie() {};
......
......@@ -8,18 +8,11 @@
***************************************************************************/
// qt/kde includes
#include <qapplication.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qstring.h>
#include <qpainter.h>
#include <qmap.h>
#include <kimageeffect.h>
#include <kdebug.h>
// system includes
#include <string.h>
// local includes
#include "page.h"
#include "pagetransition.h"
......@@ -261,182 +254,3 @@ void KPDFPageRect::deletePointer()
kdDebug() << "Object deletion not implemented for type '"
<< m_pointerType << "' ." << endl;
}
/** class PagePainter **/
void PagePainter::paintPageOnPainter( const KPDFPage * page, int id, int flags,
QPainter * destPainter, const QRect & limits, int width, int height )
{
QPixmap * pixmap = 0;
// if a pixmap is present for given id, use it
if ( page->m_pixmaps.contains( id ) )
pixmap = page->m_pixmaps[ id ];
// else find the closest match using pixmaps of other IDs (great optim!)
else if ( !page->m_pixmaps.isEmpty() && width != -1 )
{
int minDistance = -1;
QMap< int,QPixmap * >::const_iterator it = page->m_pixmaps.begin(), end = page->m_pixmaps.end();
for ( ; it != end; ++it )
{
int pixWidth = (*it)->width(),
distance = pixWidth > width ? pixWidth - width : width - pixWidth;
if ( minDistance == -1 || distance < minDistance )
{
pixmap = *it;
minDistance = distance;
}
}
}
if ( !pixmap )
{
if ( Settings::changeColors() &&
Settings::renderMode() == Settings::EnumRenderMode::Paper )
destPainter->fillRect( limits, Settings::paperColor() );
else
destPainter->fillRect( limits, Qt::white );
// draw a cross (to that the pixmap as not yet been loaded)
// helps a lot on pages that take much to render
destPainter->setPen( Qt::gray );
destPainter->drawLine( 0, 0, width-1, height-1 );
destPainter->drawLine( 0, height-1, width-1, 0 );
return;
}
// we have a pixmap to paint, now let's paint it using a direct or buffered painter
bool backBuffer = Settings::changeColors() &&
Settings::renderMode() != Settings::EnumRenderMode::Paper;
// if PagePainter::Accessibility is not in 'flags', disable backBuffer
backBuffer = backBuffer && (flags & Accessibility);
QPixmap * backPixmap = 0;
QPainter * p = destPainter;
if ( backBuffer )
{
backPixmap = new QPixmap( limits.width(), limits.height() );
p = new QPainter( backPixmap );
p->translate( -limits.left(), -limits.top() );
}
// fast blit the pixmap if it has the right size..
if ( pixmap->width() == width && pixmap->height() == height )
p->drawPixmap( limits.topLeft(), *pixmap, limits );
// ..else set a scale matrix to the painter and paint a quick 'zoomed' pixmap
else
{
p->save();
// TODO paint only the needed part
p->scale( width / (double)pixmap->width(), height / (double)pixmap->height() );
p->drawPixmap( 0,0, *pixmap, 0,0, pixmap->width(), pixmap->height() );
p->restore();
/* Code disabled (after HEAD merge). The user can recognize a wrong sized
pixmap even without the grey cross..
// draw a cross (for telling that the pixmap has not the right size)
p->setPen( Qt::gray );
p->drawLine( 0, 0, width-1, height-1 );
p->drawLine( 0, height-1, width-1, 0 );
*/ }
// modify pixmap following accessibility settings
if ( (flags & Accessibility) && backBuffer )
{
QImage backImage = backPixmap->convertToImage();
switch ( Settings::renderMode() )
{
case Settings::EnumRenderMode::Inverted:
// Invert image pixels using QImage internal function
backImage.invertPixels(false);
break;
case Settings::EnumRenderMode::Recolor:
// Recolor image using KImageEffect::flatten with dither:0
KImageEffect::flatten( backImage, Settings::recolorForeground(), Settings::recolorBackground() );
break;
case Settings::EnumRenderMode::BlackWhite: