| 212 | } |
| 213 | |
| 214 | bool checkgrayscale(SDL_Surface *s) |
| 215 | { |
| 216 | // gray scale images have 256 levels, no colorkey, and the palette is a ramp |
| 217 | if(s->format->palette) |
| 218 | { |
| 219 | Uint32 ck = 0; |
| 220 | if(s->format->palette->ncolors != 256 || SDL_GetColorKey(s, &ck) == -1) return false; |
| 221 | const SDL_Color *colors = s->format->palette->colors; |
| 222 | loopi(256) if(colors[i].r != i || colors[i].g != i || colors[i].b != i) return false; |
| 223 | } |
| 224 | return true; |
| 225 | } |
| 226 | |
| 227 | int fixcl(SDL_Surface *s, int threshold) |
| 228 | { |
no test coverage detected