Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/GDKSplashOutputDev.cc
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2005-03-01 22:24:10 (GMT)
committer Kristian Høgsberg <krh@src.gnome.org>2005-03-01 22:24:10 (GMT)
commit02eb16fef45712a91e24f6471b9e2f31249c888e (patch)
treed5579258f1d7fbd5a280fb2f1b97b74004b1dea9 /pdf/GDKSplashOutputDev.cc
parent332afee84ff4eb7df326d96f07efd6f82a87c0a2 (diff)
Use poppler instead of including xpdf source code. Poppler is a fork of
2005-03-01 Kristian Høgsberg <krh@redhat.com> Use poppler instead of including xpdf source code. Poppler is a fork of xpdf to build it as a shared library. See http://freedesktop.org/wiki/Software/poppler. * pdf/xpdf/*, pdf/goo/*, pdf/splash/*, pdf/fofi/*: Remove included xpdf fork. * pdf/Makefile.am: Build libpdfdocument.a here. * pdf/GDKSplashOutputDev.cc: * pdf/GDKSplashOutputDev.h: * pdf/GnomeVFSStream.cc: * pdf/GnomeVFSStream.h: * pdf-document.cc: * pdf-document.h: * test-gdk-output-dev.cc * Thumb.cc: * Thumb.h: Pull these files out of pdf/xpdf and adjust to compile against poppler.
Diffstat (limited to 'pdf/GDKSplashOutputDev.cc')
-rw-r--r--pdf/GDKSplashOutputDev.cc151
1 files changed, 151 insertions, 0 deletions
diff --git a/pdf/GDKSplashOutputDev.cc b/pdf/GDKSplashOutputDev.cc
new file mode 100644
index 0000000..2dc3dc9
--- /dev/null
+++ b/pdf/GDKSplashOutputDev.cc
@@ -0,0 +1,151 @@
+//========================================================================
+//
+// GDKSplashOutputDev.cc
+//
+// Copyright 2003 Glyph & Cog, LLC
+// Copyright 2004 Red Hat, Inc. (GDK port)
+//
+//========================================================================
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include <goo/gmem.h>
+#include <splash/SplashTypes.h>
+#include <splash/SplashBitmap.h>
+#include <Object.h>
+#include <GfxState.h>
+#include <TextOutputDev.h>
+#include <GDKSplashOutputDev.h>
+
+//------------------------------------------------------------------------
+// Constants and macros
+//------------------------------------------------------------------------
+
+#define xoutRound(x) ((int)(x + 0.5))
+
+//------------------------------------------------------------------------
+// GDKSplashOutputDev
+//------------------------------------------------------------------------
+
+static SplashColor makeSplashColor(int r, int g, int b)
+{
+ SplashColor c;
+ c.rgb8 = splashMakeRGB8 (r, g, b);
+ return c;
+}
+
+GDKSplashOutputDev::GDKSplashOutputDev(GdkScreen *screen,
+ void (*redrawCbkA)(void *data),
+ void *redrawCbkDataA):
+ SplashOutputDev(splashModeRGB8Packed, gFalse, makeSplashColor (255,255,255)),
+ incrementalUpdate (1)
+{
+ redrawCbk = redrawCbkA;
+ redrawCbkData = redrawCbkDataA;
+
+ // create text object
+ text = new TextPage(gFalse);
+}
+
+GDKSplashOutputDev::~GDKSplashOutputDev() {
+ delete text;
+}
+
+void GDKSplashOutputDev::drawChar(GfxState *state, double x, double y,
+ double dx, double dy,
+ double originX, double originY,
+ CharCode code, Unicode *u, int uLen) {
+ text->addChar(state, x, y, dx, dy, code, u, uLen);
+ SplashOutputDev::drawChar(state, x, y, dx, dy, originX, originY,
+ code, u, uLen);
+}
+
+GBool GDKSplashOutputDev::beginType3Char(GfxState *state, double x, double y,
+ double dx, double dy,
+ CharCode code, Unicode *u, int uLen) {
+ text->addChar(state, x, y, dx, dy, code, u, uLen);
+ return SplashOutputDev::beginType3Char(state, x, y, dx, dy, code, u, uLen);
+}
+
+void GDKSplashOutputDev::clear() {
+ startDoc(NULL);
+ startPage(0, NULL);
+}
+
+void GDKSplashOutputDev::startPage(int pageNum, GfxState *state) {
+ SplashOutputDev::startPage(pageNum, state);
+ text->startPage(state);
+}
+
+void GDKSplashOutputDev::endPage() {
+ SplashOutputDev::endPage();
+ if (!incrementalUpdate) {
+ (*redrawCbk)(redrawCbkData);
+ }
+ text->coalesce(gTrue);
+}
+
+void GDKSplashOutputDev::dump() {
+ if (incrementalUpdate && redrawCbk) {
+ (*redrawCbk)(redrawCbkData);
+ }
+}
+
+void GDKSplashOutputDev::updateFont(GfxState *state) {
+ SplashOutputDev::updateFont(state);
+ text->updateFont(state);
+}
+
+void GDKSplashOutputDev::redraw(int srcX, int srcY,
+ GdkDrawable *drawable,
+ int destX, int destY,
+ int width, int height) {
+ GdkGC *gc;
+ int gdk_rowstride;
+
+ gdk_rowstride = getBitmap()->getRowSize();
+ gc = gdk_gc_new (drawable);
+
+ gdk_draw_rgb_image (drawable, gc,
+ destX, destY,
+ width, height,
+ GDK_RGB_DITHER_NORMAL,
+ getBitmap()->getDataPtr().rgb8p + srcY * gdk_rowstride + srcX * 3,
+ gdk_rowstride);
+
+ g_object_unref (gc);
+}
+
+void GDKSplashOutputDev::drawToPixbuf(GdkPixbuf *pixbuf, int pageNum) {
+
+}
+
+GBool GDKSplashOutputDev::findText(Unicode *s, int len,
+ GBool startAtTop, GBool stopAtBottom,
+ GBool startAtLast, GBool stopAtLast,
+ int *xMin, int *yMin,
+ int *xMax, int *yMax) {
+ double xMin1, yMin1, xMax1, yMax1;
+
+ xMin1 = (double)*xMin;
+ yMin1 = (double)*yMin;
+ xMax1 = (double)*xMax;
+ yMax1 = (double)*yMax;
+ if (text->findText(s, len, startAtTop, stopAtBottom,
+ startAtLast, stopAtLast,
+ &xMin1, &yMin1, &xMax1, &yMax1)) {
+ *xMin = xoutRound(xMin1);
+ *xMax = xoutRound(xMax1);
+ *yMin = xoutRound(yMin1);
+ *yMax = xoutRound(yMax1);
+ return gTrue;
+ }
+ return gFalse;
+}
+
+GooString *GDKSplashOutputDev::getText(int xMin, int yMin, int xMax, int yMax) {
+ return text->getText((double)xMin, (double)yMin,
+ (double)xMax, (double)yMax);
+}