Skip to content

Commit

Permalink
Fix: import conversion detected colors marked as unused
Browse files Browse the repository at this point in the history
  • Loading branch information
stg committed Jul 5, 2012
1 parent 8ff9e18 commit 9a5e4a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
Binary file modified bin-win/gui.exe
Binary file not shown.
31 changes: 18 additions & 13 deletions gui/picture.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,26 +281,31 @@ void picture_convert(uint8_t *p_data) {
// full-color patterns
for(y = 0; y < h_original; y += 2) {
for(c = 0; c < MAX_COLORS; c++) {
for(x = 0; x < w; x++) {
FreeImage_GetPixelColor(dib, x, y, &quad);
FreeImage_GetPixelColor(dib, x, y + 1, &quad_two);
if(match(&quad, &color[c].color) || match(&quad_two, &color[c].color)) break;
}
if(x < w) {
if(color[c].used) {
for(x = 0; x < w; x++) {
FreeImage_GetPixelColor(dib,x,y,&quad);
p_data[(h-(y_out+1))*w+x] = (match_color(&quad) == color[c].memo) ? color[c].memo : 0xFF;
FreeImage_GetPixelColor(dib, x, y, &quad);
FreeImage_GetPixelColor(dib, x, y + 1, &quad_two);
if(match(&quad, &color[c].color) || match(&quad_two, &color[c].color)) break;
}
y_out++;
for(x = 0; x < w; x++) {
FreeImage_GetPixelColor(dib,x,y+1,&quad);
p_data[(h-(y_out+1))*w+x] = (match_color(&quad) == color[c].memo) ? color[c].memo : 0xFF;
if(x < w) {
for(x = 0; x < w; x++) {
FreeImage_GetPixelColor(dib,x,y,&quad);
p_data[(h-(y_out+1))*w+x] = (match_color(&quad) == color[c].memo) ? color[c].memo : 0xFF;
}
y_out++;
for(x = 0; x < w; x++) {
FreeImage_GetPixelColor(dib,x,y+1,&quad);
p_data[(h-(y_out+1))*w+x] = (match_color(&quad) == color[c].memo) ? color[c].memo : 0xFF;
}
y_out++;
}
y_out++;
}
}
}
}
#ifdef DEBUG
printf("conversion rows %i\n",y_out);
#endif
}

void picture_free() {
Expand Down
2 changes: 1 addition & 1 deletion win-gui-make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ rem echo [bin-win\gui_sdl12.exe] building sdl1.2 gui executable...
rem gcc -g gui/*.c lib/src/*.c res/windows.res -I lib/include/ -mwindows -lmingw32 -lsdlmain -lsdl -lsetupapi -o bin-win\gui_sdl12.exe
rem strip bin-win\gui_sdl12.exe
echo [bin-win\gui.exe] building sdl2.0 gui executable...
gcc -g gui/*.c lib/src/*.c res/windows.res -I lib/include/ -mwindows -lwinmm -lmingw32 -lsdl2main -lsdl2 -lsdl2.dll -lsetupapi -DSDL2 -lfreeimage -o bin-win\gui.exe
gcc gui/*.c lib/src/*.c res/windows.res -I lib/include/ -mwindows -lwinmm -lmingw32 -lsdl2main -lsdl2 -lsdl2.dll -lsetupapi -DSDL2 -lfreeimage -o bin-win\gui.exe
strip bin-win\gui.exe

0 comments on commit 9a5e4a0

Please sign in to comment.