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