r18937 by fschmid - Fix image and pattern loading
scribus-commit
scribus-commit at lists.scribus.net
Sun Mar 23 09:05:32 UTC 2014
Author: fschmid
Date: Sun Mar 23 09:05:32 2014
New Revision: 18937
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18937
Log:
Fix image and pattern loading
Modified:
trunk/Scribus/scribus/scimage.cpp
trunk/Scribus/scribus/util_formats.cpp
Modified: trunk/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18937&path=/trunk/Scribus/scribus/scimage.cpp
==============================================================================
--- trunk/Scribus/scribus/scimage.cpp (original)
+++ trunk/Scribus/scribus/scimage.cpp Sun Mar 23 09:05:32 2014
@@ -2243,7 +2243,7 @@
return false;
}
QString ext2 = getImageType(fn);
- if (ext.isEmpty() || (ext2 != ext))
+ if (ext.isEmpty() || (!ext2.isEmpty() && (ext2 != ext)))
ext = ext2;
if (extensionIndicatesPDF(ext))
{
Modified: trunk/Scribus/scribus/util_formats.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18937&path=/trunk/Scribus/scribus/util_formats.cpp
==============================================================================
--- trunk/Scribus/scribus/util_formats.cpp (original)
+++ trunk/Scribus/scribus/util_formats.cpp Sun Mar 23 09:05:32 2014
@@ -322,10 +322,10 @@
QFileInfo fi(f);
if (fi.exists())
{
- QByteArray buf(20, ' ');
+ QByteArray buf(24, ' ');
if (f.open(QIODevice::ReadOnly))
{
- f.read(buf.data(), 20);
+ f.read(buf.data(), 24);
if ((buf[0] == '%') && (buf[1] == '!') && (buf[2] == 'P') && (buf[3] == 'S') && (buf[4] == '-') && (buf[5] == 'A'))
ret = "eps";
else if ((buf[0] == '\xC5') && (buf[1] == '\xD0') && (buf[2] == '\xD3') && (buf[3] == '\xC6'))
@@ -334,6 +334,8 @@
ret = "gif";
else if ((buf[0] == '\xFF') && (buf[1] == '\xD8') && (buf[2] == '\xFF'))
ret = "jpg";
+ else if ((buf[20] == 'G') && (buf[21] == 'P') && (buf[22] == 'A') && (buf[23] == 'T'))
+ ret = "pat";
else if ((buf[0] == '%') && (buf[1] == 'P') && (buf[2] == 'D') && (buf[3] == 'F'))
ret = "pdf";
else if ((buf[0] == 'P') && (buf[1] == 'G') && (buf[2] == 'F'))
More information about the scribus-commit
mailing list