fix color blending when a frame has more than one color to merge with,
...fix bug #14964
This commit is contained in:
parent
9f9146f180
commit
ec0257d6fb
2 changed files with 10 additions and 2 deletions
|
@ -77,6 +77,14 @@ public:
|
|||
|
||||
static Uint32 rgb(Uint8 red, Uint8 green, Uint8 blue)
|
||||
{ return 0xFF000000 | (red << 16) | (green << 8) | blue; }
|
||||
static Uint8 red(Uint32 color)
|
||||
{ return (color & 0x00FF0000) >> 16;}
|
||||
static Uint8 green(Uint32 color)
|
||||
{ return (color & 0x0000FF00) >> 8;}
|
||||
static Uint8 blue(Uint32 color)
|
||||
{ return (color & 0x000000FF) ;}
|
||||
static Uint32 max_rgb(Uint32 first,Uint32 second)
|
||||
{ return rgb(std::max(red(first),red(second)),std::max(green(first),green(second)),std::max(blue(first),blue(second))) ; }
|
||||
|
||||
/** Gets the underlying screen object. */
|
||||
CVideo& video() { return screen_; }
|
||||
|
|
|
@ -657,11 +657,11 @@ const frame_parameters unit_frame::merge_parameters(int current_time,const frame
|
|||
|
||||
/** engine provide a blend colour for poisoned units */
|
||||
result.blend_with = current_val.blend_with?current_val.blend_with:animation_val.blend_with;
|
||||
if(primary&& engine_val.blend_with) result.blend_with = engine_val.blend_with;
|
||||
if(primary&& engine_val.blend_with) result.blend_with = display::max_rgb(engine_val.blend_with,result.blend_with);
|
||||
|
||||
/** engine provide a blend colour for poisoned units */
|
||||
result.blend_ratio = current_val.blend_ratio?current_val.blend_ratio:animation_val.blend_ratio;
|
||||
if(primary && engine_val.blend_ratio) result.blend_ratio += engine_val.blend_ratio;
|
||||
if(primary && engine_val.blend_ratio) result.blend_ratio = std::min(result.blend_ratio + engine_val.blend_ratio,1.0);
|
||||
|
||||
/** engine provide a highlight ratio for selected units and visible "invisible" units */
|
||||
result.highlight_ratio = current_val.highlight_ratio!=1.0?current_val.highlight_ratio:animation_val.highlight_ratio;
|
||||
|
|
Loading…
Add table
Reference in a new issue