summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-06-13 09:02:32 +0200
committerCarlos Garcia Campos <cgarcia@igalia.com>2012-06-15 10:09:42 +0200
commitc93969775f408284530b07288814770b88fd8e63 (patch)
tree356bbefc8988a69dccf7a7e18ee7ae34c76781f5
parent1645daf8ee4f843014c5643086e36dff42dde407 (diff)
Add GFXSplashOutputDev class for poppler compatibility
Only used when building with poppler, inherits from SplashOutputDev to expose doUpdateFont that is not protected.
-rw-r--r--lib/pdf/BitmapOutputDev.cc13
-rw-r--r--lib/pdf/BitmapOutputDev.h11
-rw-r--r--lib/pdf/GFXSplashOutputDev.h58
-rw-r--r--lib/pdf/InfoOutputDev.cc4
-rw-r--r--lib/pdf/InfoOutputDev.h4
-rw-r--r--lib/pdf/Makefile.in4
-rw-r--r--lib/pdf/popplercompat.h4
7 files changed, 81 insertions, 17 deletions
diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc
index 63f5ff93..754c152f 100644
--- a/lib/pdf/BitmapOutputDev.cc
+++ b/lib/pdf/BitmapOutputDev.cc
@@ -23,6 +23,7 @@
#include <assert.h>
#include "BitmapOutputDev.h"
#include "CharOutputDev.h"
+#include "GFXSplashOutputDev.h"
#ifdef HAVE_POPPLER
#include "splash/SplashBitmap.h"
@@ -71,19 +72,19 @@ BitmapOutputDev::BitmapOutputDev(InfoOutputDev*info, PDFDoc*doc, int*page2page,
this->xref = doc->getXRef();
/* color graphic output device, for creating bitmaps */
- this->rgbdev = new SplashOutputDev(splashModeRGB8, 1, gFalse, splash_white, gTrue, gTrue);
+ this->rgbdev = new GFXSplashOutputDev(splashModeRGB8, 1, gFalse, splash_white, gTrue, gTrue);
/* color mode for binary bitmaps */
SplashColorMode colorMode = splashModeMono1;
/* two devices for testing things against clipping: one clips, the other doesn't */
- this->clip0dev = new SplashOutputDev(colorMode, 1, gFalse, splash_black, gTrue, gFalse);
- this->clip1dev = new SplashOutputDev(colorMode, 1, gFalse, splash_black, gTrue, gFalse);
+ this->clip0dev = new GFXSplashOutputDev(colorMode, 1, gFalse, splash_black, gTrue, gFalse);
+ this->clip1dev = new GFXSplashOutputDev(colorMode, 1, gFalse, splash_black, gTrue, gFalse);
/* device indicating where polygonal pixels were drawn */
- this->boolpolydev = new SplashOutputDev(colorMode, 1, gFalse, splash_black, gTrue, gFalse);
+ this->boolpolydev = new GFXSplashOutputDev(colorMode, 1, gFalse, splash_black, gTrue, gFalse);
/* device indicating where text pixels were drawn */
- this->booltextdev = new SplashOutputDev(colorMode, 1, gFalse, splash_black, gTrue, gFalse);
+ this->booltextdev = new GFXSplashOutputDev(colorMode, 1, gFalse, splash_black, gTrue, gFalse);
/* device for handling texts and links */
this->gfxdev = new CharOutputDev(info, this->doc, page2page, num_pages, x, y, x1, y1, x2, y2);
@@ -1610,7 +1611,7 @@ void BitmapOutputDev::clearBoolTextDev()
#define USE_GETGLYPH_BBOX
-static void getGlyphBbox(GfxState*state, SplashOutputDev*splash, double x, double y, double originX, double originY, CharCode code, int*_x1, int*_y1, int*_x2, int*_y2)
+static void getGlyphBbox(GfxState*state, GFXSplashOutputDev*splash, double x, double y, double originX, double originY, CharCode code, int*_x1, int*_y1, int*_x2, int*_y2)
{
#ifdef USE_GETGLYPH_BBOX
/* use getglyph to derive bounding box */
diff --git a/lib/pdf/BitmapOutputDev.h b/lib/pdf/BitmapOutputDev.h
index 66b6edf1..d5429e52 100644
--- a/lib/pdf/BitmapOutputDev.h
+++ b/lib/pdf/BitmapOutputDev.h
@@ -27,6 +27,7 @@
#include "../../config.h"
#include "CharOutputDev.h"
#include "InfoOutputDev.h"
+#include "GFXSplashOutputDev.h"
#include "PDFDoc.h"
#include "CommonOutputDev.h"
#include "popplercompat.h"
@@ -209,11 +210,11 @@ private:
SplashPath*bboxpath;
- SplashOutputDev*rgbdev;
- SplashOutputDev*clip0dev;
- SplashOutputDev*clip1dev;
- SplashOutputDev*boolpolydev;
- SplashOutputDev*booltextdev;
+ GFXSplashOutputDev*rgbdev;
+ GFXSplashOutputDev*clip0dev;
+ GFXSplashOutputDev*clip1dev;
+ GFXSplashOutputDev*boolpolydev;
+ GFXSplashOutputDev*booltextdev;
SplashBitmap*rgbbitmap;
SplashBitmap*clip0bitmap;
diff --git a/lib/pdf/GFXSplashOutputDev.h b/lib/pdf/GFXSplashOutputDev.h
new file mode 100644
index 00000000..05cf47bb
--- /dev/null
+++ b/lib/pdf/GFXSplashOutputDev.h
@@ -0,0 +1,58 @@
+/* GFXSplashOutputDev.h
+ Output device derived from SplashOutputDev.
+
+ This file is part of swftools.
+
+ Swftools 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.
+
+ Swftools is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with swftools; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef __GFXSplashOutputDev_h__
+#define __GFXSplashOutputDev_h__
+
+#include "SplashOutputDev.h"
+
+#ifdef HAVE_POPPLER
+
+#include "../../config.h"
+#include <splash/SplashTypes.h>
+#include <splash/SplashPath.h>
+#include <splash/SplashFont.h>
+#include <splash/SplashFontFile.h>
+
+class GFXSplashOutputDev: public SplashOutputDev {
+public:
+ GFXSplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA,
+ GBool reverseVideoA, SplashColorPtr paperColorA,
+ GBool bitmapTopDownA = gTrue,
+ GBool allowAntialiasA = gTrue)
+ : SplashOutputDev(colorModeA, bitmapRowPadA, reverseVideoA, paperColorA, bitmapTopDownA, allowAntialiasA)
+ {
+ needFontUpdate = gFalse;
+ }
+
+ // OutputDev:
+ virtual void restoreState(GfxState *state) { SplashOutputDev::restoreState(state); needFontUpdate = gTrue; }
+
+ virtual void updateAll(GfxState *state) { SplashOutputDev::updateAll(state); needFontUpdate = gTrue; }
+ virtual void updateFont(GfxState *state) { SplashOutputDev::updateFont(state); needFontUpdate = gTrue; }
+
+ // SplashOutputDev:
+ void doUpdateFont(GfxState *state) { SplashOutputDev::doUpdateFont(state); needFontUpdate = gFalse; }
+
+ GBool needFontUpdate; // set when the font needs to be updated
+};
+
+#endif // HAVE_POPPLER
+
+#endif
diff --git a/lib/pdf/InfoOutputDev.cc b/lib/pdf/InfoOutputDev.cc
index 864e1bff..0512050a 100644
--- a/lib/pdf/InfoOutputDev.cc
+++ b/lib/pdf/InfoOutputDev.cc
@@ -1,7 +1,7 @@
#include "../../config.h"
#include "Object.h"
#include "InfoOutputDev.h"
-#include "SplashOutputDev.h"
+#include "GFXSplashOutputDev.h"
#include "GfxState.h"
#include "CommonOutputDev.h"
#include "../log.h"
@@ -103,7 +103,7 @@ InfoOutputDev::InfoOutputDev(PDFDoc*doc)
currentglyph = 0;
previous_was_char = 0;
SplashColor white = {255,255,255};
- splash = new SplashOutputDev(splashModeRGB8,320,0,white,0,0);
+ splash = new GFXSplashOutputDev(splashModeRGB8,320,0,white,0,0);
splash->startDoc(INFO_OUTPUT_DEV_STARTDOC_ARG);
last_font = 0;
current_type3_font = 0;
diff --git a/lib/pdf/InfoOutputDev.h b/lib/pdf/InfoOutputDev.h
index bce13db8..657df291 100644
--- a/lib/pdf/InfoOutputDev.h
+++ b/lib/pdf/InfoOutputDev.h
@@ -24,7 +24,7 @@
#include "popplercompat.h"
#include "GfxFont.h"
#include "OutputDev.h"
-#include "SplashOutputDev.h"
+#include "GFXSplashOutputDev.h"
#include "Page.h"
#ifdef HAVE_POPPLER
@@ -116,7 +116,7 @@ extern gfxmatrix_t gfxmatrix_from_state(GfxState*state);
class InfoOutputDev: public OutputDev
{
GlyphInfo* currentglyph;
- SplashOutputDev*splash;
+ GFXSplashOutputDev*splash;
char previous_was_char;
Page *page;
diff --git a/lib/pdf/Makefile.in b/lib/pdf/Makefile.in
index 7b8b1443..45232b87 100644
--- a/lib/pdf/Makefile.in
+++ b/lib/pdf/Makefile.in
@@ -49,9 +49,9 @@ VectorGraphicOutputDev.$(O): VectorGraphicOutputDev.cc VectorGraphicOutputDev.h
$(CC) -I ./ $(xpdf_include) VectorGraphicOutputDev.cc -o $@
CharOutputDev.$(O): CharOutputDev.cc CharOutputDev.h CommonOutputDev.h InfoOutputDev.h ../gfxpoly.h
$(CC) -I ./ $(xpdf_include) CharOutputDev.cc -o $@
-InfoOutputDev.$(O): InfoOutputDev.cc InfoOutputDev.h
+InfoOutputDev.$(O): InfoOutputDev.cc InfoOutputDev.h GFXSplashOutputDev.h
$(CC) -I ./ $(xpdf_include) InfoOutputDev.cc -o $@
-BitmapOutputDev.$(O): BitmapOutputDev.cc BitmapOutputDev.h CommonOutputDev.h InfoOutputDev.h
+BitmapOutputDev.$(O): BitmapOutputDev.cc BitmapOutputDev.h CommonOutputDev.h InfoOutputDev.h GFXSplashOutputDev.h
$(CC) -I ./ $(xpdf_include) BitmapOutputDev.cc -o $@
XMLOutputDev.$(O): XMLOutputDev.cc XMLOutputDev.h xpdf/TextOutputDev.h
$(CC) -I ./ $(xpdf_include) XMLOutputDev.cc -o $@
diff --git a/lib/pdf/popplercompat.h b/lib/pdf/popplercompat.h
index 8dc60bfb..877c2bd0 100644
--- a/lib/pdf/popplercompat.h
+++ b/lib/pdf/popplercompat.h
@@ -75,6 +75,10 @@ char* mktmpname(char*ptr);
#define POPPLER_GET_GLYPH_ARGS
#endif
+#ifndef HAVE_POPPLER
+ #define GFXSplashOutputDev SplashOutputDev
+#endif
+
#ifdef HAVE_POPPLER
#include <goo/GooString.h>
#include <goo/gfile.h>