Skip to content

Commit

Permalink
Fixed int -> float truncation warning in pixel.hpp
Browse files Browse the repository at this point in the history
The underlying channel type for grayscale pixels is a 32-bit float. If `Channel` cannot be losslessly converted to a float--for example, if it is `int`--this would generate a compiler warning. The fix here is to perform an explicit cast. Fixes boostorg#688.
  • Loading branch information
jsenn authored Jun 17, 2022
1 parent 1c6c427 commit 01da835
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/boost/gil/pixel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ struct pixel :
void assign(Channel const& channel, std::false_type)
{
check_gray();
gil::at_c<0>(*this) = channel;
gil::at_c<0>(*this) = static_cast<channel_t::base_channel_t>( channel );
}

template <typename Channel>
Expand Down

0 comments on commit 01da835

Please sign in to comment.