Moved inverse to standard_colors.cpp

This is the only place it's used, and it's no longer an SDL-related util now that we have color_t. It could
potentially become part of color_t, but I'd have to think about it.

This also removes the sdl/utils.hpp dependency.
This commit is contained in:
Charles Dang 2016-12-10 21:57:47 +11:00
parent 98cca22c65
commit 09e73dbc98
3 changed files with 11 additions and 13 deletions

View file

@ -14,10 +14,19 @@
#include "font/standard_colors.hpp"
#include "sdl/utils.hpp"
namespace font {
// TODO: evalulate whether this should become a color_t member
static color_t inverse(const color_t& color)
{
return {
static_cast<uint8_t>(255 - color.r),
static_cast<uint8_t>(255 - color.g),
static_cast<uint8_t>(255 - color.b),
255 // TODO: should we respect alpha?
};
}
const color_t
NORMAL_COLOR {0xDD, 0xDD, 0xDD},
GRAY_COLOR {0x77, 0x77, 0x77},

View file

@ -2462,15 +2462,6 @@ SDL_Rect get_non_transparent_portion(const surface &surf)
return res;
}
color_t inverse(const color_t& color) {
return {
static_cast<Uint8>(255 - color.r),
static_cast<Uint8>(255 - color.g),
static_cast<Uint8>(255 - color.b),
0 // TODO: ehh?
};
}
surface_restorer::surface_restorer() : target_(nullptr), rect_(sdl::empty_rect), surface_(nullptr)
{
}

View file

@ -409,8 +409,6 @@ void blit_surface(const surface& src,
SDL_Rect get_non_transparent_portion(const surface &surf);
color_t inverse(const color_t& color);
/**
* Helper class for pinning SDL surfaces into memory.
* @note This class should be used only with neutral surfaces, so that