Add explicit load methods to DirectDrawSurface.
This commit is contained in:
parent
1e0dea0738
commit
e5736fcf92
@ -803,32 +803,47 @@ bool DDSHeader::hasDX10Header() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
DirectDrawSurface::DirectDrawSurface(const char * name) : stream(new StdInputStream(name))
|
||||
DirectDrawSurface::DirectDrawSurface() : stream(NULL)
|
||||
{
|
||||
if (!stream->isError())
|
||||
{
|
||||
(*stream) << header;
|
||||
}
|
||||
}
|
||||
|
||||
DirectDrawSurface::DirectDrawSurface(Stream * s) : stream(s)
|
||||
DirectDrawSurface::DirectDrawSurface(const char * name) : stream(NULL)
|
||||
{
|
||||
if (!stream->isError())
|
||||
{
|
||||
(*stream) << header;
|
||||
}
|
||||
load(name);
|
||||
}
|
||||
|
||||
DirectDrawSurface::DirectDrawSurface(Stream * s) : stream(NULL)
|
||||
{
|
||||
load(s);
|
||||
}
|
||||
|
||||
DirectDrawSurface::~DirectDrawSurface()
|
||||
{
|
||||
delete stream;
|
||||
}
|
||||
|
||||
bool DirectDrawSurface::load(const char * filename)
|
||||
{
|
||||
return load(new StdInputStream(filename));
|
||||
}
|
||||
|
||||
bool DirectDrawSurface::load(Stream * stream)
|
||||
{
|
||||
delete this->stream;
|
||||
this->stream = stream;
|
||||
|
||||
if (!stream->isError())
|
||||
{
|
||||
(*stream) << header;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DirectDrawSurface::isValid() const
|
||||
{
|
||||
if (stream->isError())
|
||||
if (stream == NULL || stream->isError())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -113,10 +113,14 @@ namespace nv
|
||||
class NVIMAGE_CLASS DirectDrawSurface
|
||||
{
|
||||
public:
|
||||
DirectDrawSurface();
|
||||
DirectDrawSurface(const char * file);
|
||||
DirectDrawSurface(Stream * stream);
|
||||
~DirectDrawSurface();
|
||||
|
||||
bool load(const char * filename);
|
||||
bool load(Stream * stream);
|
||||
|
||||
bool isValid() const;
|
||||
bool isSupported() const;
|
||||
|
||||
@ -153,7 +157,7 @@ namespace nv
|
||||
|
||||
|
||||
private:
|
||||
Stream * const stream;
|
||||
Stream * stream;
|
||||
DDSHeader header;
|
||||
DDSHeader10 header10;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user