avoid implicit conversions between int types in mapnik::color (fixes clang++ warnings)
This commit is contained in:
parent
a90b31b7a7
commit
c51793c7e4
1 changed files with 16 additions and 14 deletions
|
@ -28,7 +28,6 @@
|
||||||
#include <mapnik/global.hpp>
|
#include <mapnik/global.hpp>
|
||||||
|
|
||||||
//boost
|
//boost
|
||||||
#include <boost/cstdint.hpp>
|
|
||||||
#include <boost/operators.hpp>
|
#include <boost/operators.hpp>
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
|
@ -40,10 +39,10 @@ class MAPNIK_DECL color
|
||||||
: boost::equality_comparable<color>
|
: boost::equality_comparable<color>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
boost::uint8_t red_;
|
unsigned char red_;
|
||||||
boost::uint8_t green_;
|
unsigned char green_;
|
||||||
boost::uint8_t blue_;
|
unsigned char blue_;
|
||||||
boost::uint8_t alpha_;
|
unsigned char alpha_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
color()
|
color()
|
||||||
|
@ -53,7 +52,10 @@ public:
|
||||||
alpha_(0xff)
|
alpha_(0xff)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
color(unsigned red, unsigned green, unsigned blue, unsigned alpha = 0xff)
|
color(unsigned char red,
|
||||||
|
unsigned char green,
|
||||||
|
unsigned char blue,
|
||||||
|
unsigned char alpha = 0xff)
|
||||||
: red_(red),
|
: red_(red),
|
||||||
green_(green),
|
green_(green),
|
||||||
blue_(blue),
|
blue_(blue),
|
||||||
|
@ -95,38 +97,38 @@ public:
|
||||||
(alpha_ == rhs.alpha());
|
(alpha_ == rhs.alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned red() const
|
inline unsigned char red() const
|
||||||
{
|
{
|
||||||
return red_;
|
return red_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned green() const
|
inline unsigned char green() const
|
||||||
{
|
{
|
||||||
return green_;
|
return green_;
|
||||||
}
|
}
|
||||||
inline unsigned blue() const
|
inline unsigned char blue() const
|
||||||
{
|
{
|
||||||
return blue_;
|
return blue_;
|
||||||
}
|
}
|
||||||
inline unsigned alpha() const
|
inline unsigned char alpha() const
|
||||||
{
|
{
|
||||||
return alpha_;
|
return alpha_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void set_red(unsigned red)
|
inline void set_red(unsigned char red)
|
||||||
{
|
{
|
||||||
red_ = red;
|
red_ = red;
|
||||||
}
|
}
|
||||||
inline void set_green(unsigned green)
|
inline void set_green(unsigned char green)
|
||||||
{
|
{
|
||||||
green_ = green;
|
green_ = green;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void set_blue(unsigned blue)
|
inline void set_blue(unsigned char blue)
|
||||||
{
|
{
|
||||||
blue_ = blue;
|
blue_ = blue;
|
||||||
}
|
}
|
||||||
inline void set_alpha(unsigned alpha)
|
inline void set_alpha(unsigned char alpha)
|
||||||
{
|
{
|
||||||
alpha_ = alpha;
|
alpha_ = alpha;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue