[poppler] poppler/qt: poppler-page.cc, 1.9, 1.10 poppler-private.h, 1.2, 1.3

Albert Astals Cid aacid at freedesktop.org
Sun Jan 1 14:18:50 PST 2006


Update of /cvs/poppler/poppler/qt
In directory gabe:/tmp/cvs-serv23879/qt

Modified Files:
	poppler-page.cc poppler-private.h 
Log Message:
      * qt/poppler-page.cc:
      * qt/poppler-private.h: Don't create a SplashOutputDev for every
        renderToPixmap.


Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt/poppler-page.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- poppler-page.cc	30 Dec 2005 22:31:32 -0000	1.9
+++ poppler-page.cc	1 Jan 2006 22:18:47 -0000	1.10
@@ -61,13 +61,8 @@
 {
   SplashOutputDev *output_dev;
   SplashBitmap *bitmap;
-  SplashColor white;
-  white[0] = 255;
-  white[1] = 255;
-  white[2] = 255;
   SplashColorPtr color_ptr;
-  output_dev = new SplashOutputDev(splashModeRGB8, 4, gFalse, white);
-  output_dev->startDoc(data->doc->data->doc.getXRef ());
+  output_dev = data->doc->data->getOutputDev();
   
   data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, xres, yres,
       0, false, false, false, -1, -1, -1, -1);
@@ -89,7 +84,6 @@
   *q = new QPixmap( *img );
   
   delete img;
-  delete output_dev;
 }
 
 QString Page::getText(const Rectangle &r) const

Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/qt/poppler-private.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- poppler-private.h	3 Dec 2005 22:20:54 -0000	1.2
+++ poppler-private.h	1 Jan 2006 22:18:48 -0000	1.3
@@ -23,10 +23,32 @@
 
 class DocumentData {
   public:
-    DocumentData(GooString *filePath, GooString *password) : doc(filePath,password) {}
+    DocumentData(GooString *filePath, GooString *password) : doc(filePath,password), m_outputDev(0) {}
+
+    ~DocumentData()
+    {
+        delete m_outputDev;
+        delete m_fontInfoScanner;
+    }
+
+    SplashOutputDev *getOutputDev()
+    {
+        if (!m_outputDev)
+        {
+            SplashColor white;
+            white[0] = 255;
+            white[1] = 255;
+            white[2] = 255;
+            m_outputDev = new SplashOutputDev(splashModeRGB8, 4, gFalse, white);
+            m_outputDev->startDoc(doc.getXRef());
+        }
+        return m_outputDev;
+    }
+
   class PDFDoc doc;
   bool locked;
   FontInfoScanner *m_fontInfoScanner;
+  SplashOutputDev *m_outputDev;
 };
 
 }



More information about the poppler mailing list