gimp r24869 - in trunk: . plug-ins/gfli
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24869 - in trunk: . plug-ins/gfli
- Date: Tue, 12 Feb 2008 07:56:56 +0000 (GMT)
Author: neo
Date: Tue Feb 12 07:56:56 2008
New Revision: 24869
URL: http://svn.gnome.org/viewvc/gimp?rev=24869&view=rev
Log:
2008-02-12 Sven Neumann <sven gimp org>
* plug-ins/gfli/fli.c: applied patch from David Capello that
fixes
loading of fli files that specify width and height as zero
(interpreting this as 320x200). It also fixes a problem in an
unused code path (writing of differential color chunks).
Modified:
trunk/ChangeLog
trunk/plug-ins/gfli/fli.c
Modified: trunk/plug-ins/gfli/fli.c
==============================================================================
--- trunk/plug-ins/gfli/fli.c (original)
+++ trunk/plug-ins/gfli/fli.c Tue Feb 12 07:56:56 2008
@@ -99,6 +99,12 @@
fli_header->magic = NO_HEADER;
}
}
+
+ if (fli_header->width == 0)
+ fli_header->width = 320;
+
+ if (fli_header->height == 0)
+ fli_header->height = 200;
}
void fli_write_header(FILE *f, s_fli_header *fli_header)
@@ -268,14 +274,14 @@
fli_write_char(f, cmap[col_pos]>>2);
}
} else {
- unsigned short num_packets, cnt_skip, cnt_col, col_pos, col_start;
- num_packets=0; col_pos=0;
+ unsigned short cnt_skip, cnt_col, col_pos, col_start;
+ col_pos=0;
do {
cnt_skip=0;
while ((col_pos<256) && (old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2])) {
cnt_skip++; col_pos++;
}
- col_start=col_pos;
+ col_start=col_pos*3;
cnt_col=0;
while ((col_pos<256) && !((old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2]))) {
cnt_col++; col_pos++;
@@ -359,14 +365,14 @@
fli_write_char(f, cmap[col_pos]);
}
} else {
- unsigned short num_packets, cnt_skip, cnt_col, col_pos, col_start;
- num_packets=0; col_pos=0;
+ unsigned short cnt_skip, cnt_col, col_pos, col_start;
+ col_pos=0;
do {
cnt_skip=0;
while ((col_pos<256) && (old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2])) {
cnt_skip++; col_pos++;
}
- col_start=col_pos;
+ col_start=col_pos*3;
cnt_col=0;
while ((col_pos<256) && !((old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2]))) {
cnt_col++; col_pos++;
@@ -375,10 +381,11 @@
num_packets++;
fli_write_char(f, cnt_skip);
fli_write_char(f, cnt_col);
- for (; cnt_col>0; cnt_col--) {
+ while (cnt_col>0) {
fli_write_char(f, cmap[col_start++]);
fli_write_char(f, cmap[col_start++]);
fli_write_char(f, cmap[col_start++]);
+ cnt_col--;
}
}
} while (col_pos<256);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]