Skip to content

Commit

Permalink
Moved inverse to standard_colors.cpp
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Vultraz committed Dec 10, 2016
1 parent 98cca22 commit 09e73db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
13 changes: 11 additions & 2 deletions src/font/standard_colors.cpp
Expand Up @@ -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},
Expand Down
9 changes: 0 additions & 9 deletions src/sdl/utils.cpp
Expand Up @@ -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)
{
}
Expand Down
2 changes: 0 additions & 2 deletions src/sdl/utils.hpp
Expand Up @@ -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
Expand Down

0 comments on commit 09e73db

Please sign in to comment.