okular/kpdf/thumbnailgenerator.cpp
Enrico Ros 727d5dd57a More refactoring. Big internal changes but nothing visible.. apart from a
memory reduction on the displayed page. OutputDev under big changes.
Now DocumentObservers have an unique ID so they can queue requests to
documents and they get their data stored in Page(s). No more Pixmaps or
Thumbnails requests, every observer can request a custom-sized pixmap for
a given page. That makes room for new observers (like a cool perspective
book like page viewer or stacked viewer or what your fantasy suggests :-).

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=346792
2004-09-15 20:45:00 +00:00

46 lines
1.5 KiB
C++

/***************************************************************************
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include <qapplication.h>
#include <qevent.h>
#include <qimage.h>
#include <qmutex.h>
#include "PDFDoc.h"
#include "QOutputDev.h"
#include "thumbnailgenerator.h"
ThumbnailGenerator::ThumbnailGenerator(PDFDoc *doc, QMutex *docMutex, int page, double ppp, QObject *o) : m_doc(doc), m_docMutex(docMutex), m_page(page), m_o(o), m_ppp(ppp)
{
}
int ThumbnailGenerator::getPage() const
{
return m_page;
}
void ThumbnailGenerator::run()
{
QCustomEvent *ce;
//QImage *i;
SplashColor paperColor;
paperColor.rgb8 = splashMakeRGB8(0xff, 0xff, 0xff);
KPDFOutputDev odev(paperColor);
odev.startDoc(m_doc->getXRef());
m_docMutex->lock();
m_doc -> displayPage(&odev, m_page, m_ppp, m_ppp, 0, true, false);
m_docMutex->unlock();
ce = new QCustomEvent(65432);
//i = new QImage(odev.getImage()); FIXME commented because the ODEV is changing
//i -> detach();
//ce -> setData(i);
QApplication::postEvent(m_o, ce);
}