Commit 855a32c6 authored by Pino Toscano's avatar Pino Toscano

isolate the tiff loading in an own function

svn path=/trunk/KDE/kdegraphics/okular/; revision=890978
parent a2b63a66
......@@ -204,21 +204,7 @@ bool TIFFGenerator::loadDocument( const QString & fileName, QVector<Okular::Page
qfile->open( QIODevice::ReadOnly );
d->dev = qfile;
d->data = QFile::encodeName( QFileInfo( *qfile ).fileName() );
d->tiff = TIFFClientOpen( d->data.constData(), "r", d->dev,
okular_tiffReadProc, okular_tiffWriteProc, okular_tiffSeekProc,
okular_tiffCloseProc, okular_tiffSizeProc,
okular_tiffMapProc, okular_tiffUnmapProc );
if ( !d->tiff )
{
delete d->dev;
d->dev = 0;
d->data.clear();
return false;
}
loadPages( pagesVector );
return true;
return loadTiff( pagesVector, d->data.constData() );
}
bool TIFFGenerator::loadDocumentFromData( const QByteArray & fileData, QVector< Okular::Page * > & pagesVector )
......@@ -227,7 +213,12 @@ bool TIFFGenerator::loadDocumentFromData( const QByteArray & fileData, QVector<
QBuffer* qbuffer = new QBuffer( &d->data );
qbuffer->open( QIODevice::ReadOnly );
d->dev = qbuffer;
d->tiff = TIFFClientOpen( "<stdin>", "r", d->dev,
return loadTiff( pagesVector, "<stdin>" );
}
bool TIFFGenerator::loadTiff( QVector< Okular::Page * > & pagesVector, const char *name )
{
d->tiff = TIFFClientOpen( name, "r", d->dev,
okular_tiffReadProc, okular_tiffWriteProc, okular_tiffSeekProc,
okular_tiffCloseProc, okular_tiffSizeProc,
okular_tiffMapProc, okular_tiffUnmapProc );
......
......@@ -36,6 +36,7 @@ class TIFFGenerator : public Okular::Generator
class Private;
Private * const d;
bool loadTiff( QVector< Okular::Page * > & pagesVector, const char *name );
void loadPages( QVector<Okular::Page*> & pagesVector );
int mapPage( int page ) const;
......
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