*plugin/gif: Support for LCT (and couple of 64bits fixes)

git-svn-id: svn://ultimatepp.org/upp/trunk@2838 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-11-07 10:58:31 +00:00
parent ea92a3c008
commit 2fc7b29312
5 changed files with 23 additions and 11 deletions

View file

@ -1139,7 +1139,7 @@ void OutStream::_Put(const void *data, dword size)
void OutStream::Flush()
{
if(ptr != buffer) {
Out(buffer, ptr - buffer);
Out(buffer, int(ptr - buffer));
ptr = h;
}
}

View file

@ -374,7 +374,7 @@ public:
void Cat(int c) { if(end >= limit) Expand(); *end++ = c; }
void Cat(int c, int count);
void Cat(const char *s, int l);
void Cat(const char *s, const char *e) { Cat(s, e - s); }
void Cat(const char *s, const char *e) { Cat(s, int(e - s)); }
void Cat(const char *s) { Cat(s, (int)strlen(s)); }
void Cat(const String& s) { Cat(s, s.GetLength()); }
@ -738,7 +738,7 @@ public:
void Cat(int c) { if(end >= limit) Expand(); *end++ = c; }
void Cat(int c, int count);
void Cat(const wchar *s, int l);
void Cat(const wchar *s, const wchar *e) { Cat(s, e - s); }
void Cat(const wchar *s, const wchar *e) { Cat(s, int(e - s)); }
void Cat(const wchar *s) { Cat(s, wstrlen(s)); }
void Cat(const WString& s) { Cat(s, s.GetLength()); }
void Cat(const char *s) { Cat(WString(s)); }

View file

@ -22,7 +22,7 @@ void PanicMessageBox(const char *title, const char *text)
if(sPanicMessageBox)
(*sPanicMessageBox)(title, text);
else {
write(2, text, strlen(text));
write(2, text, (int)strlen(text));
write(2, "\n", 1);
}
}
@ -573,7 +573,7 @@ String HexString(const String& s, int sep, int sepchr)
String ScanHexString(const char *s, const char *lim)
{
String r;
r.Reserve((lim - s) / 2);
r.Reserve(int(lim - s) / 2);
for(;;) {
byte b = 0;
while(!IsXDigit(*s)) {

View file

@ -160,7 +160,7 @@ void FileList::StartEdit() {
edit = cf.name.ToWString();
edit.Show();
edit.SetFocus();
int pos = GetFileExtPos(cf.name) - ~cf.name;
int pos = int(GetFileExtPos(cf.name) - ~cf.name);
edit.SetSelection(0, pos);
}

View file

@ -193,6 +193,7 @@ private:
GIFRaster& owner;
Stream& stream;
RasterFormat format;
RGBA gpalette[256];
RGBA palette[256];
GifGlobalInfo ggi;
Vector<byte> temp;
@ -493,7 +494,18 @@ bool GIFRaster::Data::LoadSubimage(int64 &beginPos, int &delay, int &x, int &y,
if(l.x + l.width > size.cx || l.y + l.height > size.cy)
return false; // out of bitmap rectangle
// ignore LCT
memcpy(palette, gpalette, 256 * sizeof(RGBA));
if(l.lct_flag) {
stream.Seek(l.lct_fpos);
for(int i = 0; i < l.lct_recs; i++) {
palette[i].r = stream.Get();
palette[i].g = stream.Get();
palette[i].b = stream.Get();
palette[i].a = 255;
}
}
stream.Seek(l.dat_fpos);
if((start_bpp = stream.Get()) <= 0 || start_bpp > 12)
@ -523,10 +535,10 @@ bool GIFRaster::Data::Create()
stream.Seek(ggi.gct_fpos);
for(int i = 0; i < ggi.gct_recs; i++) {
palette[i].r = stream.Get();
palette[i].g = stream.Get();
palette[i].b = stream.Get();
palette[i].a = 255;
gpalette[i].r = stream.Get();
gpalette[i].g = stream.Get();
gpalette[i].b = stream.Get();
gpalette[i].a = 255;
}
format.Set8();
GetPagesData();