Skip to content

Commit

Permalink
Convert a few more things to use color_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Dec 3, 2016
1 parent 05479c4 commit 44f8d2e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/display.cpp
Expand Up @@ -1522,7 +1522,7 @@ void display::draw_text_in_hex(const map_location& loc,
void display::render_image(int x, int y, const display::drawing_layer drawing_layer,
const map_location& loc, surface image,
bool hreverse, bool greyscale, fixed_t alpha,
Uint32 blendto, double blend_ratio, double submerged, bool vreverse)
color_t blendto, double blend_ratio, double submerged, bool vreverse)
{
if (image==nullptr)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/display.hpp
Expand Up @@ -873,7 +873,7 @@ class display : public filter_context, public video2::draw_layering
void render_image(int x, int y, const display::drawing_layer drawing_layer,
const map_location& loc, surface image,
bool hreverse=false, bool greyscale=false,
fixed_t alpha=ftofxp(1.0), Uint32 blendto=0,
fixed_t alpha=ftofxp(1.0), color_t blendto = {0,0,0},
double blend_ratio=0, double submerged=0.0,bool vreverse =false);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/image_modifications.cpp
Expand Up @@ -506,7 +506,7 @@ int cs_modification::get_b() const

surface blend_modification::operator()(const surface& src) const
{
return blend_surface(src, a_, color_t(r_, g_, b_).to_argb_bytes());
return blend_surface(src, a_, color_t(r_, g_, b_));

}

Expand Down
8 changes: 4 additions & 4 deletions src/sdl/utils.cpp
Expand Up @@ -1861,7 +1861,7 @@ surface cut_surface(const surface &surf, SDL_Rect const &r)
surface blend_surface(
const surface &surf
, const double amount
, const Uint32 color
, const color_t color
, const bool optimize)
{
if(surf== nullptr) {
Expand All @@ -1881,9 +1881,9 @@ surface blend_surface(
Uint32* end = beg + nsurf->w*surf->h;

Uint16 ratio = amount * 256;
const Uint16 red = ratio * static_cast<Uint8>(color >> 16);
const Uint16 green = ratio * static_cast<Uint8>(color >> 8);
const Uint16 blue = ratio * static_cast<Uint8>(color);
const Uint16 red = ratio * color.r;
const Uint16 green = ratio * color.g;
const Uint16 blue = ratio * color.b;
ratio = 256 - ratio;

while(beg != end) {
Expand Down
2 changes: 1 addition & 1 deletion src/sdl/utils.hpp
Expand Up @@ -340,7 +340,7 @@ surface cut_surface(const surface &surf, SDL_Rect const &r);
surface blend_surface(
const surface &surf
, const double amount
, const Uint32 color
, const color_t color
, const bool optimize = true);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/units/frame.cpp
Expand Up @@ -719,7 +719,7 @@ void unit_frame::redraw(const int frame_time,bool on_start_time,bool in_scope_of
game_display::get_singleton()->render_image( my_x,my_y,
static_cast<display::drawing_layer>(display::LAYER_UNIT_FIRST+current_data.drawing_layer),
src, image, facing_west, false,
ftofxp(current_data.highlight_ratio), current_data.blend_with,
ftofxp(current_data.highlight_ratio), color_t::from_argb_bytes(current_data.blend_with),
current_data.blend_ratio,current_data.submerge,!facing_north);
}
halo_id = halo::handle(); //halo::NO_HALO;
Expand Down

0 comments on commit 44f8d2e

Please sign in to comment.