Commit 372c34cc authored by Albert Astals Cid's avatar Albert Astals Cid

* qt4/src/poppler-private.h:

        * qt4/src/poppler-page.cc:
        * qt4/src/poppler-document.cc: Don't create a SplashOutputDev for
        every splashRenderToPixmap
parent 6ff83474
2006-01-01 Albert Astals Cid <aacid@kde.org>
* qt4/src/poppler-private.h:
* qt4/src/poppler-page.cc:
* qt4/src/poppler-document.cc: Don't create a SplashOutputDev for
every splashRenderToPixmap
* qt/poppler-page.cc:
* qt/poppler-private.h: Don't create a SplashOutputDev for every
renderToPixmap.
......
......@@ -65,7 +65,6 @@ namespace Poppler {
Document::~Document()
{
delete m_doc->m_fontInfoScanner;
delete m_doc;
}
......
......@@ -27,12 +27,12 @@
#include <ErrorCodes.h>
#include <ArthurOutputDev.h>
#include <Private.h>
#include <TextOutputDev.h>
#include "poppler-private.h"
#include <SplashOutputDev.h>
#include <TextOutputDev.h>
#include <splash/SplashBitmap.h>
#include "poppler-private.h"
namespace Poppler {
class PageData {
......@@ -57,12 +57,7 @@ Page::~Page()
QPixmap *Page::splashRenderToPixmap(double xres, double yres, int x, int y, int w, int h) const
{
SplashColor white;
white[0] = 255;
white[1] = 255;
white[2] = 255;
SplashOutputDev *output_dev = new SplashOutputDev(splashModeRGB8, 4, gFalse, white);
output_dev->startDoc(m_page->parentDoc->m_doc->doc.getXRef ());
SplashOutputDev *output_dev = m_page->parentDoc->m_doc->getSplashOutputDev();
m_page->parentDoc->m_doc->doc.displayPageSlice(output_dev, m_page->index + 1, xres, yres,
0, false, true, false, x, y, w, h);
......@@ -90,13 +85,10 @@ QPixmap *Page::splashRenderToPixmap(double xres, double yres, int x, int y, int
}
}
delete[] pixel;
// Turn the QImage into a QPixmap
QPixmap* out = new QPixmap(QPixmap::fromImage(img));
// Delete temporary buffers
delete output_dev;
return out;
}
......
......@@ -25,15 +25,37 @@ namespace Poppler {
class DocumentData {
public:
DocumentData(GooString *filePath, GooString *ownerPassword, GooString *userPassword) :
doc(filePath, ownerPassword, userPassword)
doc(filePath, ownerPassword, userPassword), m_splashOutputDev(0)
{
// It might be more appropriate to delete these in PDFDoc
delete ownerPassword;
delete userPassword;
}
~DocumentData()
{
delete m_splashOutputDev;
delete m_fontInfoScanner;
}
SplashOutputDev *getSplashOutputDev()
{
if (!m_splashOutputDev)
{
SplashColor white;
white[0] = 255;
white[1] = 255;
white[2] = 255;
m_splashOutputDev = new SplashOutputDev(splashModeRGB8, 4, gFalse, white);
m_splashOutputDev->startDoc(doc.getXRef());
}
return m_splashOutputDev;
}
class PDFDoc doc;
bool locked;
FontInfoScanner *m_fontInfoScanner;
SplashOutputDev *m_splashOutputDev;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment