Commit c4e612d6 authored by Christophe Devriese's avatar Christophe Devriese

bugfixes, removed a lot of processEvent calls that caused crashes

svn path=/trunk/kdegraphics/kpdf/; revision=242829
parent 100be6fa
......@@ -71,7 +71,11 @@ struct QOutFontSubst {
};
static QOutFontSubst qStdFonts [] = {
{ "Helvetica", "Helvetica", false, false, QFont::Helvetica },
{ "Helvetica",
"Helvetica",
false,
false,
QFont::Helvetica },
{ "Helvetica-Oblique", "Helvetica", false, true, QFont::Helvetica },
{ "Helvetica-Bold", "Helvetica", true, false, QFont::Helvetica },
{ "Helvetica-BoldOblique", "Helvetica", true, true, QFont::Helvetica },
......@@ -90,12 +94,6 @@ static QOutFontSubst qStdFonts [] = {
{ 0, 0, false, false, QFont::AnyStyle }
};
QFont QOutputDev::matchFont ( GfxFont *gfxFont, fp_t m11, fp_t m12, fp_t m21, fp_t m22 )
{
static QDict<QOutFontSubst> stdfonts;
......@@ -427,7 +425,6 @@ void QOutputDev::stroke ( GfxState *state )
}
j += len;
}
qApp-> processEvents ( );
}
void QOutputDev::fill ( GfxState *state )
......@@ -478,8 +475,6 @@ void QOutputDev::doFill ( GfxState *state, bool winding )
j += len;
}
m_painter-> setPen ( oldpen );
qApp-> processEvents ( );
}
void QOutputDev::clip ( GfxState *state )
......@@ -532,7 +527,6 @@ void QOutputDev::doClip ( GfxState *state, bool winding )
// m_painter-> fillRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( ), red );
// m_painter-> drawText ( points [0]. x ( ) + 10, points [0]. y ( ) + 10, "Bla bla" );
qApp-> processEvents ( );
}
//
......@@ -713,7 +707,6 @@ void QOutputDev::drawChar ( GfxState *state, fp_t x, fp_t y,
// some PDF files use CID 0, which is .notdef, so just ignore it
qWarning ( "Unknown character (CID=%d Unicode=%hx)\n", code, (unsigned short) ( uLen > 0 ? u [0] : (Unicode) 0 ));
}
qApp-> processEvents ( );
}
......@@ -776,7 +769,6 @@ void QOutputDev::drawImageMask ( GfxState *state, Object */*ref*/, Stream *str,
}
ctm [3] > 0 ? scanlines-- : scanlines++;
qApp-> processEvents ( );
}
#ifndef QT_NO_TRANSFORMATIONS
......@@ -821,14 +813,12 @@ void QOutputDev::drawImageMask ( GfxState *state, Object */*ref*/, Stream *str,
QPDFDBG( printf ( "DRAWING IMAGE MASKED: %d/%d - %dx%d\n", x, y, w, h ));
img = img. smoothScale ( w, h );
qApp-> processEvents ( );
m_painter-> drawImage ( x, y, img );
}
#endif
delete imgStr;
qApp-> processEvents ( );
}
......@@ -903,8 +893,6 @@ void QOutputDev::drawImage(GfxState *state, Object */*ref*/, Stream *str, int wi
ctm [0] < 0 ? scanline-- : scanline++;
}
ctm [3] > 0 ? scanlines-- : scanlines++;
qApp-> processEvents ( );
}
......@@ -951,7 +939,6 @@ void QOutputDev::drawImage(GfxState *state, Object */*ref*/, Stream *str, int wi
QPDFDBG( printf ( "DRAWING IMAGE: %d/%d - %dx%d\n", x, y, w, h ));
img = img. smoothScale ( w, h );
qApp-> processEvents ( );
m_painter-> drawImage ( x, y, img );
}
......@@ -959,7 +946,6 @@ void QOutputDev::drawImage(GfxState *state, Object */*ref*/, Stream *str, int wi
delete imgStr;
qApp-> processEvents ( );
}
......
......@@ -235,6 +235,7 @@ void QOutputDevPixmap::saveState ( GfxState */*state*/ )
void QOutputDevPixmap::restoreState ( GfxState */*state*/ )
{
if (! m_painter) return;
m_painter-> restore ( );
// m_painter-> setClipRegion ( QRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( )));
......@@ -408,7 +409,6 @@ void QOutputDevPixmap::stroke ( GfxState *state )
}
j += len;
}
qApp-> processEvents ( );
}
void QOutputDevPixmap::fill ( GfxState *state )
......@@ -460,7 +460,6 @@ void QOutputDevPixmap::doFill ( GfxState *state, bool winding )
}
m_painter-> setPen ( oldpen );
qApp-> processEvents ( );
}
void QOutputDevPixmap::clip ( GfxState *state )
......@@ -513,7 +512,6 @@ void QOutputDevPixmap::doClip ( GfxState *state, bool winding )
// m_painter-> fillRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( ), red );
// m_painter-> drawText ( points [0]. x ( ) + 10, points [0]. y ( ) + 10, "Bla bla" );
qApp-> processEvents ( );
}
//
......@@ -694,7 +692,6 @@ void QOutputDevPixmap::drawChar ( GfxState *state, fp_t x, fp_t y,
// some PDF files use CID 0, which is .notdef, so just ignore it
qWarning ( "Unknown character (CID=%d Unicode=%hx)\n", code, (unsigned short) ( uLen > 0 ? u [0] : (Unicode) 0 ));
}
qApp-> processEvents ( );
}
......@@ -756,8 +753,6 @@ void QOutputDevPixmap::drawImageMask ( GfxState *state, Object */*ref*/, Stream
ctm [0] < 0 ? scanline-- : scanline++;
}
ctm [3] > 0 ? scanlines-- : scanlines++;
qApp-> processEvents ( );
}
#ifndef QT_NO_TRANSFORMATIONS
......@@ -802,14 +797,12 @@ void QOutputDevPixmap::drawImageMask ( GfxState *state, Object */*ref*/, Stream
QPDFDBG( printf ( "DRAWING IMAGE MASKED: %d/%d - %dx%d\n", x, y, w, h ));
img = img. smoothScale ( w, h );
qApp-> processEvents ( );
m_painter-> drawImage ( x, y, img );
}
#endif
delete imgStr;
qApp-> processEvents ( );
}
......@@ -885,7 +878,6 @@ void QOutputDevPixmap::drawImage(GfxState *state, Object */*ref*/, Stream *str,
}
ctm [3] > 0 ? scanlines-- : scanlines++;
qApp-> processEvents ( );
}
......@@ -932,7 +924,6 @@ void QOutputDevPixmap::drawImage(GfxState *state, Object */*ref*/, Stream *str,
QPDFDBG( printf ( "DRAWING IMAGE: %d/%d - %dx%d\n", x, y, w, h ));
img = img. smoothScale ( w, h );
qApp-> processEvents ( );
m_painter-> drawImage ( x, y, img );
}
......@@ -940,7 +931,6 @@ void QOutputDevPixmap::drawImage(GfxState *state, Object */*ref*/, Stream *str,
delete imgStr;
qApp-> processEvents ( );
}
......
......@@ -2,6 +2,7 @@
#include <qcursor.h>
#include <qpainter.h>
#include <qmutex.h>
#include "PDFDoc.h"
......@@ -103,6 +104,9 @@ namespace KPDF
void PageWidget::setPage(int page)
{
static QMutex mutex;
mutex.lock();
if (m_doc)
{
m_currentPage = max(0, min( page, m_doc->getNumPages()));
......@@ -110,6 +114,7 @@ namespace KPDF
m_currentPage = 0;
}
updatePixmap();
mutex.unlock();
};
void PageWidget::updatePixmap()
......
......@@ -125,7 +125,7 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
permissions, fileID, userPassword, fileKey);
}
GBool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength,
GBool Decrypt::makeFileKey2(int /* encVersion */, int encRevision, int keyLength,
GString *ownerKey, GString *userKey,
int permissions, GString *fileID,
GString *userPassword, Guchar *fileKey) {
......
......@@ -410,7 +410,7 @@ void SampledFunction::transform(double *in, double *out) {
// ExponentialFunction
//------------------------------------------------------------------------
ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) {
ExponentialFunction::ExponentialFunction(Object * /* funcObj */, Dict *dict) {
Object obj1, obj2;
GBool hasN;
int i;
......@@ -536,7 +536,7 @@ void ExponentialFunction::transform(double *in, double *out) {
// StitchingFunction
//------------------------------------------------------------------------
StitchingFunction::StitchingFunction(Object *funcObj, Dict *dict) {
StitchingFunction::StitchingFunction(Object * /* funcObj */, Dict *dict) {
Object obj1, obj2;
int i;
......
......@@ -1452,11 +1452,11 @@ int JBIG2Stream::lookChar() {
return EOF;
}
GString *JBIG2Stream::getPSFilter(char *indent) {
GString *JBIG2Stream::getPSFilter(char * /* indent */) {
return NULL;
}
GBool JBIG2Stream::isBinary(GBool last) {
GBool JBIG2Stream::isBinary(GBool /* last */) {
return str->isBinary(gTrue);
}
......
......@@ -137,12 +137,6 @@ public:
int width, int height, GfxImageColorMap *colorMap,
int *maskColors, GBool inlineImg);
#if OPI_SUPPORT
//----- OPI functions
virtual void opiBegin(GfxState *state, Dict *opiDict);
virtual void opiEnd(GfxState *state, Dict *opiDict);
#endif
//----- Type 3 font operators
virtual void type3D0(GfxState *state, double wx, double wy) {}
virtual void type3D1(GfxState *state, double wx, double wy,
......
......@@ -202,12 +202,17 @@ void PDFDoc::displayPage(OutputDev *out, int page, double zoom,
int rotate, GBool doLinks,
GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData) {
if ( page < 0 || page >= catalog->getNumPages() ) return; // obviously invalid page
Page *p;
if (globalParams->getPrintCommands()) {
printf("***** page %d *****\n", page);
}
p = catalog->getPage(page);
if (doLinks) {
if (links) {
delete links;
......
......@@ -252,6 +252,8 @@ void TextPage::beginString(GfxState *state, double x0, double y0) {
void TextPage::addChar(GfxState *state, double x, double y,
double dx, double dy, Unicode *u, int uLen) {
if (! curStr) return;
double x1, y1, w1, h1, dx2, dy2;
int n, i;
......@@ -305,6 +307,8 @@ void TextPage::endString() {
}
void TextPage::addString(TextString *str) {
if (! str) return;
TextString *p1, *p2;
// throw away zero-length strings -- they don't have valid xMin/xMax
......
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