no extra tiff

This commit is contained in:
Xiao YiFang 2022-08-06 15:09:15 +08:00
parent 48711e73ba
commit bad2419c23
2 changed files with 8 additions and 11 deletions

12
tiff.cc
View file

@ -1,10 +1,7 @@
/* This file is (c) 2014 Abs62
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifdef MAKE_EXTRA_TIFF_HANDLER
#include "tiff.hh"
#ifdef MAKE_EXTRA_TIFF_HANDLER
#if defined (Q_OS_WIN)
#include "tiff/tiff.h"
#include "tiff/tiffio.h"
@ -12,6 +9,7 @@
#include "tiff.h"
#include "tiffio.h"
#endif
#endif
#include <QBuffer>
#include <QApplication>
@ -19,7 +17,7 @@
namespace GdTiff
{
#ifdef MAKE_EXTRA_TIFF_HANDLER
tsize_t tiffReadProc( thandle_t fd, tdata_t buf, tsize_t size )
{
return static_cast< QIODevice * >( fd )->read( static_cast< char * >( buf ), size );
@ -140,7 +138,7 @@ bool tiffToQImage( const char * data, int size, QImage & image )
TIFFClose( tiff );
return false;
}
#endif
void tiff2img( vector< char > & data, const char * format )
{
QImage img = QImage::fromData( (unsigned char *)&data.front(), data.size() );
@ -169,4 +167,4 @@ void tiff2img( vector< char > & data, const char * format )
} // namespace
#endif

View file

@ -1,21 +1,20 @@
#ifndef __TIFF_HH_INCLUDED__
#define __TIFF_HH_INCLUDED__
#ifdef MAKE_EXTRA_TIFF_HANDLER
#include <QImage>
#include <vector>
using std::vector;
namespace GdTiff
{
#ifdef MAKE_EXTRA_TIFF_HANDLER
// QImage don't handle TIFF files if TIFFTAG_PHOTOMETRIC is not set
// We will handle such 1-bit b/w images with default photometric
bool tiffToQImage( const char * data, int size, QImage & image );
#endif
void tiff2img( vector< char > & data, const char * format = "webp" );
}
#endif
#endif // TIFF_HH