Skip to content
Browse files

Fix: import conversion detected colors marked as unused

  • Loading branch information...
1 parent 8ff9e18 commit 9a5e4a050c79d9036fcaef2e20449a3fdfe40dfb @stg committed Jul 5, 2012
Showing with 19 additions and 14 deletions.
  1. BIN bin-win/gui.exe
  2. +18 −13 gui/picture.c
  3. +1 −1 win-gui-make.bat
View
BIN bin-win/gui.exe
Binary file not shown.
View
31 gui/picture.c
@@ -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() {
View
2 win-gui-make.bat
@@ -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.
Something went wrong with that request. Please try again.