Commit e1432fd7 authored by Albert Astals Cid's avatar Albert Astals Cid

* configure.ac

        * poppler/Makefile.am
        * qt4/src/Makefile.am
        * qt4/src/poppler-document.cc
        * qt4/src/poppler-link.cc
        * qt4/src/poppler-page.cc
        * qt4/src/poppler-private.h
        * qt4/src/poppler-qt4.h: Make the Qt4 backend compilable even with
        no Splash backend. Patch by Pino Toscano <pino@kde.org>.
parent 457038e9
2007-01-13 Albert Astals Cid <aacid@kde.org>
* configure.ac
* poppler/Makefile.am
* qt4/src/Makefile.am
* qt4/src/poppler-document.cc
* qt4/src/poppler-link.cc
* qt4/src/poppler-page.cc
* qt4/src/poppler-private.h
* qt4/src/poppler-qt4.h: Make the Qt4 backend compilable even with
no Splash backend. Patch by Pino Toscano <pino@kde.org>.
2007-01-13 Albert Astals Cid <aacid@kde.org> 2007-01-13 Albert Astals Cid <aacid@kde.org>
* poppler/Stream.h: * poppler/Stream.h:
......
...@@ -237,11 +237,6 @@ fi ...@@ -237,11 +237,6 @@ fi
AC_SUBST(POPPLER_QT4_CXXFLAGS) AC_SUBST(POPPLER_QT4_CXXFLAGS)
AC_SUBST(POPPLER_QT4_LIBS) AC_SUBST(POPPLER_QT4_LIBS)
if test x$enable_splash_output != xyes; then
if test x$enable_poppler_qt4 = xyes; then
enable_poppler_qt4="no because of disabled splash"
fi
fi
AM_CONDITIONAL(BUILD_POPPLER_QT4, test "x$enable_poppler_qt4" = "xyes") AM_CONDITIONAL(BUILD_POPPLER_QT4, test "x$enable_poppler_qt4" = "xyes")
if test x$enable_poppler_qt4 = xyes; then if test x$enable_poppler_qt4 = xyes; then
......
...@@ -13,8 +13,6 @@ splash_libs = \ ...@@ -13,8 +13,6 @@ splash_libs = \
$(SPLASH_LIBS) \ $(SPLASH_LIBS) \
$(top_builddir)/splash/libsplash.la $(top_builddir)/splash/libsplash.la
endif
if BUILD_POPPLER_QT4 if BUILD_POPPLER_QT4
poppler_arthur = libpoppler-arthur.la poppler_arthur = libpoppler-arthur.la
...@@ -31,6 +29,9 @@ arthur_libs = \ ...@@ -31,6 +29,9 @@ arthur_libs = \
endif endif
endif
if BUILD_CAIRO_OUTPUT if BUILD_CAIRO_OUTPUT
......
...@@ -31,9 +31,13 @@ libpoppler_qt4_la_SOURCES = \ ...@@ -31,9 +31,13 @@ libpoppler_qt4_la_SOURCES = \
libpoppler_qt4_la_LIBADD = \ libpoppler_qt4_la_LIBADD = \
$(top_builddir)/poppler/libpoppler.la \ $(top_builddir)/poppler/libpoppler.la \
$(top_builddir)/poppler/libpoppler-arthur.la \
$(FONTCONFIG_LIBS) \ $(FONTCONFIG_LIBS) \
$(POPPLER_QT4_LIBS) $(POPPLER_QT4_LIBS)
if BUILD_SPLASH_OUTPUT
libpoppler_qt4_la_LIBADD += \
$(top_builddir)/poppler/libpoppler-arthur.la
endif
libpoppler_qt4_la_LDFLAGS = -version-info 1:0:0 libpoppler_qt4_la_LDFLAGS = -version-info 1:0:0
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "poppler-qt4.h" #include "poppler-qt4.h"
#include <config.h>
#include <ErrorCodes.h> #include <ErrorCodes.h>
#include <GlobalParams.h> #include <GlobalParams.h>
#include <Outline.h> #include <Outline.h>
...@@ -30,8 +31,6 @@ ...@@ -30,8 +31,6 @@
#include <UGooString.h> #include <UGooString.h>
#include <Catalog.h> #include <Catalog.h>
#include <splash/SplashBitmap.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtGui/QImage> #include <QtGui/QImage>
...@@ -403,6 +402,9 @@ namespace Poppler { ...@@ -403,6 +402,9 @@ namespace Poppler {
LinkDestination *Document::linkDestination( const QString &name ) LinkDestination *Document::linkDestination( const QString &name )
{ {
if ( m_doc->getOutputDev() == NULL )
return NULL;
UGooString * namedDest = QStringToUGooString( name ); UGooString * namedDest = QStringToUGooString( name );
LinkDestinationData ldd(NULL, namedDest, m_doc); LinkDestinationData ldd(NULL, namedDest, m_doc);
LinkDestination *ld = new LinkDestination(ldd); LinkDestination *ld = new LinkDestination(ldd);
...@@ -462,6 +464,16 @@ namespace Poppler { ...@@ -462,6 +464,16 @@ namespace Poppler {
return m_doc->m_backend; return m_doc->m_backend;
} }
QSet<Document::RenderBackend> Document::availableRenderBackends()
{
QSet<Document::RenderBackend> ret;
#if defined(HAVE_SPLASH)
ret << Document::SplashBackend;
ret << Document::ArthurBackend;
#endif
return ret;
}
QDateTime convertDate( char *dateString ) QDateTime convertDate( char *dateString )
{ {
int year; int year;
......
...@@ -69,6 +69,7 @@ namespace Poppler { ...@@ -69,6 +69,7 @@ namespace Poppler {
int leftAux, topAux, rightAux, bottomAux; int leftAux, topAux, rightAux, bottomAux;
OutputDev *sod = data.doc->getOutputDev(); OutputDev *sod = data.doc->getOutputDev();
if (sod == NULL) return;
sod->cvtUserToDev( left, top, &leftAux, &topAux ); sod->cvtUserToDev( left, top, &leftAux, &topAux );
sod->cvtUserToDev( right, bottom, &rightAux, &bottomAux ); sod->cvtUserToDev( right, bottom, &rightAux, &bottomAux );
......
...@@ -22,14 +22,17 @@ ...@@ -22,14 +22,17 @@
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtGui/QImage> #include <QtGui/QImage>
#include <QtGui/QPainter> #include <QtGui/QPainter>
#include <config.h>
#include <GlobalParams.h> #include <GlobalParams.h>
#include <PDFDoc.h> #include <PDFDoc.h>
#include <Catalog.h> #include <Catalog.h>
#include <ErrorCodes.h> #include <ErrorCodes.h>
#include <ArthurOutputDev.h>
#include <SplashOutputDev.h>
#include <TextOutputDev.h> #include <TextOutputDev.h>
#if defined(HAVE_SPLASH)
#include <SplashOutputDev.h>
#include <splash/SplashBitmap.h> #include <splash/SplashBitmap.h>
#include <ArthurOutputDev.h>
#endif
#include "poppler-private.h" #include "poppler-private.h"
#include "poppler-page-transition-private.h" #include "poppler-page-transition-private.h"
...@@ -169,6 +172,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, ...@@ -169,6 +172,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
{ {
case Poppler::Document::SplashBackend: case Poppler::Document::SplashBackend:
{ {
#if defined(HAVE_SPLASH)
SplashOutputDev *splash_output = static_cast<SplashOutputDev *>(m_page->parentDoc->m_doc->getOutputDev()); SplashOutputDev *splash_output = static_cast<SplashOutputDev *>(m_page->parentDoc->m_doc->getOutputDev());
m_page->parentDoc->m_doc->doc.displayPageSlice(splash_output, m_page->index + 1, xres, yres, m_page->parentDoc->m_doc->doc.displayPageSlice(splash_output, m_page->index + 1, xres, yres,
...@@ -201,10 +205,12 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, ...@@ -201,10 +205,12 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
img = tmpimg.copy(); img = tmpimg.copy();
// unload underlying xpdf bitmap // unload underlying xpdf bitmap
splash_output->startPage( 0, NULL ); splash_output->startPage( 0, NULL );
#endif
break; break;
} }
case Poppler::Document::ArthurBackend: case Poppler::Document::ArthurBackend:
{ {
#if defined(HAVE_SPLASH)
QSize size = pageSize(); QSize size = pageSize();
QImage tmpimg(w == -1 ? size.width() : w, h == -1 ? size.height() : h, QImage::Format_ARGB32); QImage tmpimg(w == -1 ? size.width() : w, h == -1 ? size.height() : h, QImage::Format_ARGB32);
...@@ -231,6 +237,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, ...@@ -231,6 +237,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
painter.restore(); painter.restore();
painter.end(); painter.end();
img = tmpimg; img = tmpimg;
#endif
break; break;
} }
} }
...@@ -455,6 +462,9 @@ void Page::defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool up ...@@ -455,6 +462,9 @@ void Page::defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool up
QList<Link*> Page::links() const QList<Link*> Page::links() const
{ {
QList<Link*> popplerLinks; QList<Link*> popplerLinks;
OutputDev *output_dev = m_page->parentDoc->m_doc->getOutputDev();
if (output_dev == NULL)
return popplerLinks;
Links *xpdfLinks = m_page->parentDoc->m_doc->doc.takeLinks(); Links *xpdfLinks = m_page->parentDoc->m_doc->doc.takeLinks();
for (int i = 0; i < xpdfLinks->getNumLinks(); ++i) for (int i = 0; i < xpdfLinks->getNumLinks(); ++i)
...@@ -466,7 +476,6 @@ QList<Link*> Page::links() const ...@@ -466,7 +476,6 @@ QList<Link*> Page::links() const
xpdfLink->getRect( &left, &top, &right, &bottom ); xpdfLink->getRect( &left, &top, &right, &bottom );
QRectF linkArea; QRectF linkArea;
OutputDev *output_dev = m_page->parentDoc->m_doc->getOutputDev();
output_dev->cvtUserToDev( left, top, &leftAux, &topAux ); output_dev->cvtUserToDev( left, top, &leftAux, &topAux );
output_dev->cvtUserToDev( right, bottom, &rightAux, &bottomAux ); output_dev->cvtUserToDev( right, bottom, &rightAux, &bottomAux );
linkArea.setLeft(leftAux); linkArea.setLeft(leftAux);
......
...@@ -20,14 +20,18 @@ ...@@ -20,14 +20,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include <config.h>
#include <GfxState.h> #include <GfxState.h>
#include <GlobalParams.h> #include <GlobalParams.h>
#include <Link.h> #include <Link.h>
#include <Outline.h> #include <Outline.h>
#include <PDFDoc.h> #include <PDFDoc.h>
#include <FontInfo.h> #include <FontInfo.h>
#include <SplashOutputDev.h>
#include <UGooString.h> #include <UGooString.h>
#include <OutputDev.h>
#if defined(HAVE_SPLASH)
#include <SplashOutputDev.h>
#endif
...@@ -111,6 +115,7 @@ namespace Poppler { ...@@ -111,6 +115,7 @@ namespace Poppler {
// create a splash backend even in case of the Arthur Backend // create a splash backend even in case of the Arthur Backend
case Document::SplashBackend: case Document::SplashBackend:
{ {
#if defined(HAVE_SPLASH)
SplashColor bgColor; SplashColor bgColor;
bgColor[0] = paperColor.red(); bgColor[0] = paperColor.red();
bgColor[1] = paperColor.green(); bgColor[1] = paperColor.green();
...@@ -118,6 +123,7 @@ namespace Poppler { ...@@ -118,6 +123,7 @@ namespace Poppler {
SplashOutputDev * splashOutputDev = new SplashOutputDev(splashModeRGB8Qt, 4, gFalse, bgColor); SplashOutputDev * splashOutputDev = new SplashOutputDev(splashModeRGB8Qt, 4, gFalse, bgColor);
splashOutputDev->startDoc(doc.getXRef()); splashOutputDev->startDoc(doc.getXRef());
m_outputDev = splashOutputDev; m_outputDev = splashOutputDev;
#endif
break; break;
} }
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtCore/QDateTime> #include <QtCore/QDateTime>
#include <QtCore/QSet>
#include <QtCore/QVector> #include <QtCore/QVector>
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
#include <QtXml/QDomDocument> #include <QtXml/QDomDocument>
...@@ -731,6 +732,11 @@ height = dummy.height(); ...@@ -731,6 +732,11 @@ height = dummy.height();
*/ */
RenderBackend renderBackend() const; RenderBackend renderBackend() const;
/**
The available rendering backends.
*/
static QSet<RenderBackend> availableRenderBackends();
~Document(); ~Document();
private: private:
......
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