mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 03:30:20 +00:00
patch_072,074,079
svn path=/branches/kpdf/annotations/kdegraphics/kpdf/; revision=424922
This commit is contained in:
parent
cdec4298f9
commit
0412271845
20
configure.in.bot
Normal file
20
configure.in.bot
Normal file
|
@ -0,0 +1,20 @@
|
|||
if test -z "$FREETYPE_CONFIG"; then
|
||||
echo ""
|
||||
echo "You're missing freetype development libs."
|
||||
echo "KPDF will not be build without them"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test -z "$XFT_LIBS"; then
|
||||
echo ""
|
||||
echo "You're missing XFT development libs."
|
||||
echo "KPDF will not be build without them"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test "$HAVE_LIBJPEG" = "no"; then
|
||||
echo ""
|
||||
echo "You're missing libjpeg development libs."
|
||||
echo "KPDF will not be build without them"
|
||||
echo ""
|
||||
fi
|
|
@ -27,7 +27,10 @@ if test -n "$FREETYPE_CONFIG"; then
|
|||
|
||||
else
|
||||
AC_MSG_WARN([You need at least libfreetype 2.0.5])
|
||||
DO_NOT_COMPILE="$DO_NOT_COMPILE kpdf"
|
||||
fi
|
||||
else
|
||||
DO_NOT_COMPILE="$DO_NOT_COMPILE kpdf"
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBFREETYPE_LIBS)
|
||||
|
@ -50,6 +53,19 @@ if test -z "$XFT_LIBS"; then
|
|||
DO_NOT_COMPILE="$DO_NOT_COMPILE kpdf"
|
||||
fi
|
||||
|
||||
dnl ##### Check for libjpeg
|
||||
AC_CHECK_LIB([jpeg], [jpeg_destroy_decompress],HAVE_LIBJPEG=yes,HAVE_LIBJPEG=no)
|
||||
if test "$HAVE_LIBJPEG" = "yes"; then
|
||||
AC_CHECK_HEADERS([jpeglib.h],,HAVE_LIBJPEG=no)
|
||||
fi
|
||||
|
||||
if test "$HAVE_LIBJPEG" = "yes"; then
|
||||
LIBJPEG_LIBS="-ljpeg"
|
||||
AC_SUBST(LIBJPEG_LIBS)
|
||||
else
|
||||
DO_NOT_COMPILE="$DO_NOT_COMPILE kpdf"
|
||||
fi
|
||||
|
||||
|
||||
dnl ##### Check for libpaper (Debian).
|
||||
LIBPAPER_LIBS=
|
||||
|
|
110
xpdf/xpdf/DCTStream.cc
Normal file
110
xpdf/xpdf/DCTStream.cc
Normal file
|
@ -0,0 +1,110 @@
|
|||
//========================================================================
|
||||
//
|
||||
// DCTStream.cc
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "DCTStream.h"
|
||||
|
||||
static void str_init_source(j_decompress_ptr /*cinfo*/)
|
||||
{
|
||||
}
|
||||
|
||||
static boolean str_fill_input_buffer(j_decompress_ptr cinfo)
|
||||
{
|
||||
struct str_src_mgr * src = (struct str_src_mgr *)cinfo->src;
|
||||
src->buffer = src->str->getChar();
|
||||
src->pub.next_input_byte = &src->buffer;
|
||||
src->pub.bytes_in_buffer = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void str_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
|
||||
{
|
||||
struct str_src_mgr * src = (struct str_src_mgr *)cinfo->src;
|
||||
if (num_bytes > 0) {
|
||||
while (num_bytes > (long) src->pub.bytes_in_buffer) {
|
||||
num_bytes -= (long) src->pub.bytes_in_buffer;
|
||||
str_fill_input_buffer(cinfo);
|
||||
}
|
||||
src->pub.next_input_byte += (size_t) num_bytes;
|
||||
src->pub.bytes_in_buffer -= (size_t) num_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
static void str_term_source(j_decompress_ptr /*cinfo*/)
|
||||
{
|
||||
}
|
||||
|
||||
DCTStream::DCTStream(Stream *strA):
|
||||
FilterStream(strA) {
|
||||
|
||||
jpeg_create_decompress(&cinfo);
|
||||
src.pub.init_source = str_init_source;
|
||||
src.pub.fill_input_buffer = str_fill_input_buffer;
|
||||
src.pub.skip_input_data = str_skip_input_data;
|
||||
src.pub.resync_to_restart = jpeg_resync_to_restart;
|
||||
src.pub.term_source = str_term_source;
|
||||
src.pub.bytes_in_buffer = 0;
|
||||
src.pub.next_input_byte = NULL;
|
||||
src.str = str;
|
||||
cinfo.src = (jpeg_source_mgr *)&src;
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
x = 0;
|
||||
}
|
||||
|
||||
DCTStream::~DCTStream() {
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
delete str;
|
||||
}
|
||||
|
||||
void DCTStream::reset() {
|
||||
int row_stride;
|
||||
|
||||
str->reset();
|
||||
jpeg_read_header(&cinfo, TRUE);
|
||||
jpeg_start_decompress(&cinfo);
|
||||
|
||||
row_stride = cinfo.output_width * cinfo.output_components;
|
||||
row_buffer = cinfo.mem->alloc_sarray((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
|
||||
}
|
||||
|
||||
int DCTStream::getChar() {
|
||||
int c;
|
||||
|
||||
if (x == 0) {
|
||||
if (cinfo.output_scanline < cinfo.output_height)
|
||||
jpeg_read_scanlines(&cinfo, row_buffer, 1);
|
||||
else return EOF;
|
||||
}
|
||||
c = row_buffer[0][x];
|
||||
x++;
|
||||
if (x == cinfo.output_width * cinfo.output_components)
|
||||
x = 0;
|
||||
return c;
|
||||
}
|
||||
|
||||
int DCTStream::lookChar() {
|
||||
int c;
|
||||
c = row_buffer[0][x];
|
||||
return c;
|
||||
}
|
||||
|
||||
GString *DCTStream::getPSFilter(int psLevel, const char *indent) {
|
||||
GString *s;
|
||||
|
||||
if (psLevel < 2) {
|
||||
return NULL;
|
||||
}
|
||||
if (!(s = str->getPSFilter(psLevel, indent))) {
|
||||
return NULL;
|
||||
}
|
||||
s->append(indent)->append("<< >> /DCTDecode filter\n");
|
||||
return s;
|
||||
}
|
||||
|
||||
GBool DCTStream::isBinary(GBool /*last*/) {
|
||||
return str->isBinary(gTrue);
|
||||
}
|
71
xpdf/xpdf/DCTStream.h
Normal file
71
xpdf/xpdf/DCTStream.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
//========================================================================
|
||||
//
|
||||
// DCTStream.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef DCTSTREAM_H
|
||||
#define DCTSTREAM_H
|
||||
#include <config.h>
|
||||
|
||||
#ifdef USE_GCC_PRAGMAS
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_GCC_PRAGMAS
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "goo/gmem.h"
|
||||
#include "goo/gfile.h"
|
||||
#include "Error.h"
|
||||
#include "Object.h"
|
||||
#ifndef NO_DECRYPTION
|
||||
#include "Decrypt.h"
|
||||
#endif
|
||||
#include "Stream.h"
|
||||
|
||||
extern "C" {
|
||||
#include <jpeglib.h>
|
||||
}
|
||||
|
||||
struct str_src_mgr {
|
||||
struct jpeg_source_mgr pub;
|
||||
JOCTET buffer;
|
||||
Stream *str;
|
||||
};
|
||||
|
||||
|
||||
class DCTStream: public FilterStream {
|
||||
public:
|
||||
|
||||
DCTStream(Stream *strA);
|
||||
virtual ~DCTStream();
|
||||
virtual StreamKind getKind() { return strDCT; }
|
||||
virtual void reset();
|
||||
virtual int getChar();
|
||||
virtual int lookChar();
|
||||
virtual GString *getPSFilter(int psLevel, const char *indent);
|
||||
virtual GBool isBinary(GBool last = gTrue);
|
||||
Stream *getRawStream() { return str; }
|
||||
|
||||
private:
|
||||
unsigned int x;
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
struct str_src_mgr src;
|
||||
JSAMPARRAY row_buffer;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,9 +1,9 @@
|
|||
INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../fofi -I$(srcdir)/../splash -I$(srcdir)/../goo $(all_includes) $(LIBFREETYPE_CFLAGS) $(XFT_CFLAGS) $(X_INCLUDES) $(QT_INCLUDES)
|
||||
|
||||
libxpdf_la_LDFLAGS = $(all_libraries)
|
||||
libxpdf_la_LIBADD = $(LIB_X11) $(LIBFREETYPE_LIBS) $(LIBPAPER_LIBS) $(XFT_LIBS) ../goo/libgoo.la ../fofi/libfofi.la ../splash/libsplash.la
|
||||
libxpdf_la_LIBADD = $(LIB_X11) $(LIBFREETYPE_LIBS) $(LIBPAPER_LIBS) $(XFT_LIBS) $(LIBJPEG_LIBS) ../goo/libgoo.la ../fofi/libfofi.la ../splash/libsplash.la
|
||||
libxpdf_la_SOURCES = Annot.cc Array.cc BuiltinFont.cc BuiltinFontTables.cc \
|
||||
Catalog.cc CharCodeToUnicode.cc CMap.cc Decrypt.cc Dict.cc \
|
||||
Catalog.cc CharCodeToUnicode.cc CMap.cc Decrypt.cc Dict.cc DCTStream.cc \
|
||||
FontEncodingTables.cc Function.cc Gfx.cc \
|
||||
GfxFont.cc GfxState.cc GlobalParams.cc JArithmeticDecoder.cc \
|
||||
JBIG2Stream.cc Lexer.cc Link.cc NameToCharCode.cc Object.cc Outline.cc \
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "JBIG2Stream.h"
|
||||
#include "JPXStream.h"
|
||||
#include "Stream-CCITT.h"
|
||||
#include "DCTStream.h"
|
||||
|
||||
#ifdef __DJGPP__
|
||||
static GBool setDJSYSFLAGS = gFalse;
|
||||
|
@ -1786,6 +1787,7 @@ GBool CCITTFaxStream::isBinary(GBool /*last*/) {
|
|||
return str->isBinary(gTrue);
|
||||
}
|
||||
|
||||
#if 0
|
||||
//------------------------------------------------------------------------
|
||||
// DCTStream
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -3176,7 +3178,7 @@ GString *DCTStream::getPSFilter(int psLevel, const char *indent) {
|
|||
GBool DCTStream::isBinary(GBool /*last*/) {
|
||||
return str->isBinary(gTrue);
|
||||
}
|
||||
|
||||
#endif
|
||||
//------------------------------------------------------------------------
|
||||
// FlateStream
|
||||
//------------------------------------------------------------------------
|
||||
|
|
|
@ -534,6 +534,9 @@ private:
|
|||
void eatBits(int n) { inputBits -= n; }
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// DCTStream
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -634,6 +637,7 @@ private:
|
|||
int readMarker();
|
||||
int read16();
|
||||
};
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FlateStream
|
||||
|
|
Loading…
Reference in a new issue