r24643 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sat May 1 02:26:20 UTC 2021


Author: jghali
Date: Sat May  1 02:26:20 2021
New Revision: 24643

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24643
Log:
Code cleanup

Modified:
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gimp.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pgf.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_qt.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.h

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h	Sat May  1 02:26:20 2021
@@ -18,6 +18,31 @@
 
 class ScImgDataLoader
 {
+public:
+	virtual ~ScImgDataLoader() {};
+
+	const QStringList& supportedFormats() const { return m_supportedFormats; }
+	bool  supportFormat(const QString& fmt);
+
+	RawImage    r_image;
+
+	QImage&          image() { return m_image; }
+	QByteArray&      embeddedProfile() { return m_embeddedProfile; }
+	ImageInfoRecord& imageInfoRecord() { return m_imageInfoRecord; }
+	eColorFormat     pixelFormat() { return m_pixelFormat; }
+	void             setRequest(bool valid, const QMap<int, ImageLoadRequest>& req);
+
+	bool  issuedErrorMsg(void)      const { return (m_msgType == errorMsg); }
+	bool  issuedWarningMsg(void)    const { return (m_msgType == warningMsg); }
+	const QString& getMessage(void) const { return m_message; }
+
+	virtual void initialize(void);
+
+	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) = 0;
+	virtual void loadEmbeddedProfile(const QString& fn, int page = 0) = 0;
+	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail) = 0;
+	virtual bool useRawImage() const { return false; }
+
 protected:
 	ScImgDataLoader();
 
@@ -44,32 +69,6 @@
 	QString getPascalString(QDataStream & s);
 	double decodePSDfloat(uint data);
 	void parseResourceData( QDataStream & s, const PSDHeader & header, uint size );
-
-public:
-	virtual ~ScImgDataLoader() {};
-
-	const QStringList& supportedFormats() const { return m_supportedFormats; }
-	bool  supportFormat(const QString& fmt);
-
-	RawImage    r_image;
-
-	QImage&          image() { return m_image; }
-	QByteArray&      embeddedProfile() { return m_embeddedProfile; }
-	ImageInfoRecord& imageInfoRecord() { return m_imageInfoRecord; }
-	eColorFormat     pixelFormat() { return m_pixelFormat; }
-	void             setRequest(bool valid, const QMap<int, ImageLoadRequest>& req);
-
-	bool  issuedErrorMsg(void)      const { return (m_msgType == errorMsg); }
-	bool  issuedWarningMsg(void)    const { return (m_msgType == warningMsg); }
-	const QString& getMessage(void) const { return m_message; }
-
-	void initialize(void);
-
-//	virtual void preloadAlphaChannel(const QString& fn, int res) = 0;
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) = 0;
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0) = 0;
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail) = 0;
-	virtual bool useRawImage() { return false; }
 };
 
 #endif

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gimp.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gimp.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gimp.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gimp.h	Sat May  1 02:26:20 2021
@@ -11,17 +11,15 @@
 
 class ScImgDataLoader_GIMP : public ScImgDataLoader
 {
-protected:
-
-	void initSupportedFormatList();
-
 public:
 	ScImgDataLoader_GIMP();
 
-//	virtual void preloadAlphaChannel(const QString& fn, int res);
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
+protected:
+	void initSupportedFormatList();
 };
 
 #endif

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.h	Sat May  1 02:26:20 2021
@@ -25,21 +25,19 @@
 
 class ScImgDataLoader_JPEG : public ScImgDataLoader
 {
+public:
+	ScImgDataLoader_JPEG();
+
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
 protected:
-
 	void initSupportedFormatList();
 
 	bool marker_is_icc (jpeg_saved_marker_ptr marker);
 	bool marker_is_photoshop (jpeg_saved_marker_ptr marker);
 	bool read_jpeg_marker (UINT8 requestmarker, j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned int *icc_data_len);
-
-public:
-	ScImgDataLoader_JPEG();
-
-//	virtual void preloadAlphaChannel(const QString& fn, int res);
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
 };
 
 #endif

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.h	Sat May  1 02:26:20 2021
@@ -18,9 +18,9 @@
 public:
 	ScImgDataLoader_KRA();
 
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
 
 protected:
 	void initSupportedFormatList();

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.h	Sat May  1 02:26:20 2021
@@ -18,9 +18,10 @@
 public:
 	ScImgDataLoader_ORA();
 
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
 protected:
 	void initSupportedFormatList();
 	void parseStackXML(QDomElement &elem, ScPainter *painter, ScZipHandler *uz);

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.h	Sat May  1 02:26:20 2021
@@ -11,17 +11,15 @@
 
 class ScImgDataLoader_PDF : public ScImgDataLoader
 {
-protected:
-
-	void initSupportedFormatList();
-
 public:
 	ScImgDataLoader_PDF();
 
-//	virtual void preloadAlphaChannel(const QString& fn, int res);
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
+protected:
+	void initSupportedFormatList();
 };
 
 #endif

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pgf.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pgf.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pgf.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pgf.h	Sat May  1 02:26:20 2021
@@ -11,16 +11,15 @@
 
 class ScImgDataLoader_PGF : public ScImgDataLoader
 {
-protected:
-
-	void initSupportedFormatList();
-
 public:
 	ScImgDataLoader_PGF();
 
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
+protected:
+	void initSupportedFormatList();
 };
 
 #endif

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.h	Sat May  1 02:26:20 2021
@@ -20,16 +20,15 @@
 
 class ScImgDataLoader_PICT : public ScImgDataLoader
 {
-protected:
-
-	void initSupportedFormatList();
-
 public:
 	ScImgDataLoader_PICT();
 
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
+protected:
+	void initSupportedFormatList();
 
 private:
 	void parseHeader(const QString& fName, double &x, double &y, double &w, double &h);

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.h	Sat May  1 02:26:20 2021
@@ -15,8 +15,8 @@
 public:
 	ScImgDataLoader_PNG();
 
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
 
 protected:
 	void initSupportedFormatList();

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.h	Sat May  1 02:26:20 2021
@@ -12,8 +12,16 @@
 
 class ScImgDataLoader_PS : public ScImgDataLoader
 {
+public:
+	ScImgDataLoader_PS();
+
+	void initialize() override;
+
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
 protected:
-
 	void initSupportedFormatList();
 	void scanForFonts(const QString& fn);
 	bool parseData(const QString& fn);
@@ -55,16 +63,6 @@
 	QString m_psCommand;
 	QMap<QString,ScColor> m_CustColors;
 	QStringList m_FontListe;
-
-public:
-	ScImgDataLoader_PS();
-
-	virtual void initialize();
-
-//	virtual void preloadAlphaChannel(const QString& fn, int res);
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
 };
 
 #endif

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.h	Sat May  1 02:26:20 2021
@@ -30,12 +30,11 @@
 
 	ScImgDataLoader_PSD();
 
-//	virtual void preloadAlphaChannel(const QString& fn, int res);
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
 
-	virtual bool useRawImage() { return true; }
+	bool useRawImage() const  override { return true; }
 
 protected:
 

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_qt.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_qt.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_qt.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_qt.h	Sat May  1 02:26:20 2021
@@ -11,17 +11,15 @@
 
 class ScImgDataLoader_QT : public ScImgDataLoader
 {
-protected:
-
-	void initSupportedFormatList();
-
 public:
 	ScImgDataLoader_QT();
 
-//	virtual void preloadAlphaChannel(const QString& fn, int res);
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
+protected:
+	void initSupportedFormatList();
 };
 
 #endif

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	Sat May  1 02:26:20 2021
@@ -51,7 +51,7 @@
 	if (!tif)
 		return;
 
-	uint32 EmbedLen = 0;
+	uint32_t EmbedLen = 0;
 	void*  EmbedBuffer;
 	if (TIFFGetField(tif, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer))
 	{
@@ -156,7 +156,7 @@
 	if (!tif)
 		return false;
 
-	uint16 extrasamples, *extratypes;
+	uint16_t extrasamples, *extratypes;
 	hasAlpha = false;
 	do
 	{
@@ -248,9 +248,9 @@
 	}
 }
 
-bool ScImgDataLoader_TIFF::getImageData(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16 photometric, uint16 bitspersample, uint16 samplesperpixel, bool &bilevel, bool &isCMYK)
+bool ScImgDataLoader_TIFF::getImageData(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16_t photometric, uint16_t bitspersample, uint16_t samplesperpixel, bool &bilevel, bool &isCMYK)
 {
-	uint32 *bits = nullptr;
+	uint32_t *bits = nullptr;
 	if (photometric == PHOTOMETRIC_SEPARATED)
 	{
 		if (samplesperpixel > 5)
@@ -266,26 +266,26 @@
 		{
 			if (TIFFIsTiled(tif))
 			{
-				uint32 columns, rows;
-				uint32 *tile_buf;
-				uint32 xt, yt;
+				uint32_t columns, rows;
+				uint32_t *tile_buf;
+				uint32_t xt, yt;
 				TIFFGetField(tif, TIFFTAG_TILEWIDTH,  &columns);
 				TIFFGetField(tif, TIFFTAG_TILELENGTH, &rows);
-				tile_buf = (uint32*) _TIFFmalloc(columns*rows*sizeof(uint32));
+				tile_buf = (uint32_t*) _TIFFmalloc(columns * rows * sizeof(uint32_t));
 				if (tile_buf == nullptr)
 				{
 					TIFFClose(tif);
 					return false;
 				}
-				uint32 tileW = columns, tileH = rows;
-				for (yt = 0; yt < (uint32) image->height(); yt += rows)
+				uint32_t tileW = columns, tileH = rows;
+				for (yt = 0; yt < (uint32_t) image->height(); yt += rows)
 				{
 					if (yt > (uint) image->height())
 						break;
 					if (image->height()-yt < rows)
 						tileH = image->height()-yt;
 					tileW = columns;
-					uint32 yi;
+					uint32_t yi;
 					int chans = image->channels();
 					for (xt = 0; xt < (uint) image->width(); xt += columns)
 					{
@@ -301,7 +301,7 @@
 			else
 			{
 				tsize_t bytesperrow = TIFFScanlineSize(tif);
-				bits = (uint32 *) _TIFFmalloc(bytesperrow);
+				bits = (uint32_t *) _TIFFmalloc(bytesperrow);
 				int chans = image->channels();
 				if (bits)
 				{
@@ -351,13 +351,13 @@
 	return true;
 }
 
-bool ScImgDataLoader_TIFF::getImageData_RGBA(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16 bitspersample, uint16 samplesperpixel)
+bool ScImgDataLoader_TIFF::getImageData_RGBA(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16_t bitspersample, uint16_t samplesperpixel)
 {
-	uint32* bits = (uint32 *) _TIFFmalloc(size * sizeof(uint32));
+	uint32_t* bits = (uint32_t *) _TIFFmalloc(size * sizeof(uint32_t));
 	if (!bits)
 		return false;
 
-	uint16  extrasamples(0), *extratypes(nullptr);
+	uint16_t  extrasamples(0), *extratypes(nullptr);
 	if (!TIFFGetField (tif, TIFFTAG_EXTRASAMPLES, &extrasamples, &extratypes))
 		extrasamples = 0;
 	
@@ -371,7 +371,7 @@
 			{
 				unsigned char *s = image->scanLine( heightt - 1 - y );
 				unsigned char r, g, b, a;
-				for (uint xi=0; xi < widtht; ++xi)
+				for (uint xi = 0; xi < widtht; ++xi)
 				{
 					r = s[0];
 					g = s[1];
@@ -693,7 +693,7 @@
 	bool isCMYK = false;
 	unsigned int widtht, heightt, size;
 	char *description=nullptr, *copyright=nullptr, *datetime=nullptr, *artist=nullptr, *scannerMake=nullptr, *scannerModel=nullptr;
-	uint16 bitspersample, fillorder, planar;
+	uint16_t bitspersample, fillorder, planar;
 
 	TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &widtht);
 	TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &heightt);
@@ -723,7 +723,7 @@
 	m_imageInfoRecord.exifInfo.artist = QString(artist);
 	m_imageInfoRecord.exifInfo.thumbnail = QImage();
 	m_imageInfoRecord.exifDataValid = true;
-	uint32 EmbedLen = 0;
+	uint32_t EmbedLen = 0;
 	void*  EmbedBuffer;
 	if (TIFFGetField(tif, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer))
 	{
@@ -1052,7 +1052,7 @@
 
 bool ScImgDataLoader_TIFF::loadChannel( QDataStream & s, const PSDHeader & header, QList<PSDLayer> &layerInfo, uint layer, int channel, int component, RawImage &tmpImg)
 {
-	uint base = s.device()->pos();
+	qint64 base = s.device()->pos();
 	uchar cbyte;
 	ushort compression;
 	s >> compression;
@@ -1060,7 +1060,7 @@
 		return false;
 	if (compression == 0)
 	{
-		int count = layerInfo[layer].channelLen[channel]-2;
+		int count = layerInfo[layer].channelLen[channel] - 2;
 		for (int i = 0; i < tmpImg.height(); i++)
 		{
 			uchar *ptr =  tmpImg.scanLine(i);
@@ -1167,7 +1167,7 @@
 			}
 		}
 	}
-	s.device()->seek( base+layerInfo[layer].channelLen[channel] );
+	s.device()->seek( base + layerInfo[layer].channelLen[channel] );
 	return true;
 }
 
@@ -1323,8 +1323,8 @@
 	// Known values:
 	//   0: no compression
 	//   1: RLE compressed
-	uint base = s.device()->pos();
-	uint base2 = base;
+	qint64 base = s.device()->pos();
+	qint64 base2 = base;
 	uint channel_num = layerInfo[layer].channelLen.count();
 	bool hasMask = false;
 	bool hasAlpha = false;

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.h	Sat May  1 02:26:20 2021
@@ -7,13 +7,25 @@
 #ifndef SCIMGDATALOADER_TIFF_H
 #define SCIMGDATALOADER_TIFF_H
 
+#include <cstdint>
 #include <tiffio.h>
+
 #include "scimgdataloader.h"
 //Added by qt3to4:
 #include <QList>
 
 class ScImgDataLoader_TIFF : public ScImgDataLoader
 {
+public:
+	ScImgDataLoader_TIFF();
+
+//	virtual void preloadAlphaChannel(const QString& fn, int res);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
+	bool useRawImage() const override { return true; }
+
 protected:
 
 	enum PSDColorMode
@@ -29,8 +41,8 @@
 	};
 	void initSupportedFormatList();
 	int  getLayers(const QString& fn, int page);
-	bool getImageData(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16 m_photometric, uint16 bitspersample, uint16 m_samplesperpixel, bool &bilevel, bool &isCMYK);
-	bool getImageData_RGBA(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16 bitspersample, uint16 m_samplesperpixel);
+	bool getImageData(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16_t m_photometric, uint16_t bitspersample, uint16_t m_samplesperpixel, bool &bilevel, bool &isCMYK);
+	bool getImageData_RGBA(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16_t bitspersample, uint16_t m_samplesperpixel);
 	void blendOntoTarget(RawImage *tmp, int layOpa, const QString& layBlend, bool cmyk, bool useMask);
 	QString getLayerString(QDataStream & s);
 	bool loadChannel( QDataStream & s, const PSDHeader & header, QList<PSDLayer> &layerInfo, uint layer, int channel, int component, RawImage &tmpImg);
@@ -40,18 +52,8 @@
 	bool testAlphaChannelAvailability(const QString& fn, int page, bool& hasAlpha);
 	void unmultiplyRGBA(RawImage *image);
 
-	int    m_random_table[4096];
-	uint16 m_photometric, m_samplesperpixel;
-
-public:
-	ScImgDataLoader_TIFF();
-
-//	virtual void preloadAlphaChannel(const QString& fn, int res);
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
-
-	virtual bool useRawImage() { return true; }
+	int      m_random_table[4096];
+	uint16_t m_photometric, m_samplesperpixel;
 };
 
 #endif

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp	Sat May  1 02:26:20 2021
@@ -323,6 +323,7 @@
 	}
 	QByteArray ba = file.readAll();
 	file.close();
+
 	initialize();
 
 	libwpg::WPGMemoryStream input(ba.constData(), ba.size());

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24643&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.h	Sat May  1 02:26:20 2021
@@ -56,15 +56,15 @@
 
 class ScImgDataLoader_WPG : public ScImgDataLoader
 {
-protected:
-
-	void initSupportedFormatList();
-
 public:
 	ScImgDataLoader_WPG();
 
-	virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha);
-	virtual void loadEmbeddedProfile(const QString& fn, int page = 0);
-	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
+	bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
+	void loadEmbeddedProfile(const QString& fn, int page = 0) override;
+	bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
+
+protected:
+	void initSupportedFormatList();
 };
+
 #endif




More information about the scribus-commit mailing list