Fix PSD file format support. Read stream in big endian format.
This commit is contained in:
parent
2ea2aaaf4d
commit
6cdfaaca58
@ -25,7 +25,9 @@ SET(IMAGE_SRCS
|
||||
NormalMap.h
|
||||
NormalMap.cpp
|
||||
NormalMipmap.h
|
||||
NormalMipmap.cpp)
|
||||
NormalMipmap.cpp
|
||||
PsdFile.h
|
||||
TgaFile.h)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
@ -76,6 +76,9 @@ Image * nv::ImageIO::load(const char * name, Stream & s)
|
||||
return loadPNG(s);
|
||||
}
|
||||
#endif
|
||||
if (strCaseCmp(extension, ".psd") == 0) {
|
||||
return loadPSD(s);
|
||||
}
|
||||
// @@ use image plugins?
|
||||
|
||||
return NULL;
|
||||
@ -323,16 +326,20 @@ Image * nv::ImageIO::loadPSD(Stream & s)
|
||||
nvCheck(!s.isError());
|
||||
nvCheck(s.isLoading());
|
||||
|
||||
s.setByteOrder(Stream::BigEndian);
|
||||
|
||||
PsdHeader header;
|
||||
s << header;
|
||||
|
||||
if (!header.isValid())
|
||||
{
|
||||
printf("invalid header!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!header.isSupported())
|
||||
{
|
||||
printf("unsupported file!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -33,12 +33,13 @@ namespace nv
|
||||
|
||||
bool isValid() const
|
||||
{
|
||||
return signature == 0x38425053; // '8BPS'
|
||||
return signature == 0x38425053; // 38425053; // '8BPS'
|
||||
}
|
||||
|
||||
bool isSupported() const
|
||||
{
|
||||
if (version != 1) {
|
||||
printf("*** bad version number %u\n", version);
|
||||
return false;
|
||||
}
|
||||
if (channel_count > 4) {
|
||||
|
Loading…
Reference in New Issue
Block a user