[poppler] poppler/qt: poppler-page.cc,1.13,1.14
Albert Astals Cid
aacid at kemper.freedesktop.org
Tue Apr 4 14:01:03 PDT 2006
Update of /cvs/poppler/poppler/qt
In directory kemper:/tmp/cvs-serv26801/qt
Modified Files:
poppler-page.cc
Log Message:
* splash/Splash.cc:
* splash/SplashBitmap.cc: Make Splashbitmap RGB8 use 32bits internally
* qt/poppler-page.cc:
* qt4/src/poppler-page.cc: Adapt to splashbitmap change so copying to
QImage is faster.
Patch by Frank Meerkötter slightly modified by Albert Astals Cid
I'll leave adapting the glib frontend for you guys, i tried to adapt it but i got lost at gdk_pixbuf_get_n_channels (pixbuf);
Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt/poppler-page.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- poppler-page.cc 10 Jan 2006 21:57:28 -0000 1.13
+++ poppler-page.cc 4 Apr 2006 21:01:01 -0000 1.14
@@ -76,18 +76,12 @@
color_ptr = bitmap->getDataPtr ();
int bw = output_dev->getBitmap()->getWidth();
int bh = output_dev->getBitmap()->getHeight();
-
- QImage img( bw, bh, 32 );
- SplashColorPtr pixel = new Guchar[4];
- for (int i = 0; i < bw; i++)
- {
- for (int j = 0; j < bh; j++)
- {
- output_dev->getBitmap()->getPixel(i, j, pixel);
- img.setPixel( i, j, qRgb( pixel[0], pixel[1], pixel[2] ) );
- }
- }
- delete[] pixel;
+ SplashColorPtr dataPtr = output_dev->getBitmap()->getDataPtr();
+ // construct a qimage SHARING the raw bitmap data in memory
+ QImage img( dataPtr, bw, bh, 32, 0, 0, QImage::IgnoreEndian );
+ img = img.copy();
+ // unload underlying xpdf bitmap
+ output_dev->startPage( 0, NULL );
return img;
}
More information about the poppler
mailing list