diff options
author | Kristian 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) |
commit | 02eb16fef45712a91e24f6471b9e2f31249c888e (patch) | |
tree | d5579258f1d7fbd5a280fb2f1b97b74004b1dea9 /pdf/splash/SplashBitmap.cc | |
parent | 332afee84ff4eb7df326d96f07efd6f82a87c0a2 (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/splash/SplashBitmap.cc')
-rw-r--r-- | pdf/splash/SplashBitmap.cc | 157 |
1 files changed, 0 insertions, 157 deletions
diff --git a/pdf/splash/SplashBitmap.cc b/pdf/splash/SplashBitmap.cc deleted file mode 100644 index 0bec16e..0000000 --- a/pdf/splash/SplashBitmap.cc +++ /dev/null @@ -1,157 +0,0 @@ -//======================================================================== -// -// SplashBitmap.cc -// -//======================================================================== - -#include <aconf.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdio.h> -#include "gmem.h" -#include "SplashErrorCodes.h" -#include "SplashBitmap.h" - -//------------------------------------------------------------------------ -// SplashBitmap -//------------------------------------------------------------------------ - -SplashBitmap::SplashBitmap(int widthA, int heightA, SplashColorMode modeA) { - width = widthA; - height = heightA; - mode = modeA; - switch (mode) { - case splashModeMono1: - rowSize = (width + 7) >> 3; - data.mono1 = (SplashMono1P *) - gmalloc(rowSize * height * sizeof(SplashMono1P)); - break; - case splashModeMono8: - rowSize = width; - data.mono8 = (SplashMono8 *) - gmalloc(width * height * sizeof(SplashMono8)); - break; - case splashModeRGB8: - rowSize = width << 2; - data.rgb8 = (SplashRGB8 *) - gmalloc(width * height * sizeof(SplashRGB8)); - break; - case splashModeRGB8Packed: - rowSize = (width * 3 + 3) & ~3; - data.rgb8p = (SplashRGB8P *) - gmalloc(rowSize * height * sizeof(SplashRGB8P)); - break; - case splashModeBGR8Packed: - rowSize = (width * 3 + 3) & ~3; - data.bgr8 = (SplashBGR8P *) - gmalloc(rowSize * height * sizeof(SplashMono1P)); - } -} - - -SplashBitmap::~SplashBitmap() { - switch (mode) { - case splashModeMono1: - gfree(data.mono1); - break; - case splashModeMono8: - gfree(data.mono8); - break; - case splashModeRGB8: - gfree(data.rgb8); - break; - case splashModeRGB8Packed: - gfree(data.rgb8p); - break; - case splashModeBGR8Packed: - gfree(data.bgr8); - } -} - -SplashError SplashBitmap::writePNMFile(char *fileName) { - FILE *f; - SplashMono1P *mono1; - SplashMono8 *mono8; - SplashRGB8 *rgb8; - SplashRGB8P *rgb8pline, *rgb8p; - SplashBGR8P *bgr8line, *bgr8; - int x, y; - - if (!(f = fopen(fileName, "wb"))) { - return splashErrOpenFile; - } - - switch (mode) { - - case splashModeMono1: - fprintf(f, "P4\n%d %d\n", width, height); - mono1 = data.mono1; - for (y = 0; y < height; ++y) { - for (x = 0; x < width; x += 8) { - fputc(*mono1 ^ 0xff, f); - ++mono1; - } - } - break; - - case splashModeMono8: - fprintf(f, "P5\n%d %d\n255\n", width, height); - mono8 = data.mono8; - for (y = 0; y < height; ++y) { - for (x = 0; x < width; ++x) { - fputc(*mono8, f); - ++mono8; - } - } - break; - - case splashModeRGB8: - fprintf(f, "P6\n%d %d\n255\n", width, height); - rgb8 = data.rgb8; - for (y = 0; y < height; ++y) { - for (x = 0; x < width; ++x) { - fputc(splashRGB8R(*rgb8), f); - fputc(splashRGB8G(*rgb8), f); - fputc(splashRGB8B(*rgb8), f); - ++rgb8; - } - } - break; - - case splashModeRGB8Packed: - fprintf(f, "P6\n%d %d\n255\n", width, height); - rgb8pline = data.rgb8p; - for (y = 0; y < height; ++y) { - rgb8p = rgb8pline; - for (x = 0; x < width; ++x) { - fputc(rgb8p[0], f); - fputc(rgb8p[1], f); - fputc(rgb8p[2], f); - rgb8p += 3; - } - rgb8pline += rowSize; - } - break; - - case splashModeBGR8Packed: - fprintf(f, "P6\n%d %d\n255\n", width, height); - bgr8line = data.bgr8; - for (y = 0; y < height; ++y) { - bgr8 = bgr8line; - for (x = 0; x < width; ++x) { - fputc(bgr8[2], f); - fputc(bgr8[1], f); - fputc(bgr8[0], f); - bgr8 += 3; - } - bgr8line += rowSize; - } - break; - } - - fclose(f); - return splashOk; -} |