mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.cosmetics
git-svn-id: svn://ultimatepp.org/upp/trunk@11499 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e805067cd7
commit
a1dd116809
1 changed files with 5 additions and 10 deletions
|
|
@ -228,40 +228,35 @@ void Image::Serialize(Stream& s)
|
|||
Size dots = GetDots();
|
||||
s % sz % p % dots;
|
||||
int64 len = (int64)sz.cx * (int64)sz.cy * (int64)sizeof(RGBA);
|
||||
if(s.IsLoading())
|
||||
if(s.IsLoading()) {
|
||||
if(len) {
|
||||
// if(s.GetPos() + len > s.GetSize()) {
|
||||
// s.SetError();
|
||||
// return;
|
||||
// }
|
||||
// TODO: Add invalid stream protection
|
||||
ImageBuffer b;
|
||||
if(len < 6 * 1024 * 1024) {
|
||||
b.Create(sz);
|
||||
if(!s.GetAll(~b, (int)len)) {
|
||||
s.LoadError();
|
||||
Clear();
|
||||
s.LoadError();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Huge h;
|
||||
if(!s.GetAll(h, (size_t)len)) {
|
||||
s.LoadError();
|
||||
Clear();
|
||||
s.LoadError();
|
||||
return;
|
||||
}
|
||||
b.Create(sz);
|
||||
h.Get(~b);
|
||||
}
|
||||
|
||||
|
||||
|
||||
b.SetDots(dots);
|
||||
b.SetHotSpot(p);
|
||||
*this = b;
|
||||
}
|
||||
else
|
||||
Clear();
|
||||
}
|
||||
else
|
||||
s.Put64(~*this, len);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue