summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-19 16:54:09 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-19 16:54:09 +0300
commit349038b1af02729ef04b546826138b432c8fa92e (patch)
treee78f1cffb7135f74304f15da00e54cb3e3d83b08
parent66effbbdc1ed9ead3727ccfe36e9cde3eca16a3c (diff)
downloadmanaplus-349038b1af02729ef04b546826138b432c8fa92e.tar.gz
manaplus-349038b1af02729ef04b546826138b432c8fa92e.tar.bz2
manaplus-349038b1af02729ef04b546826138b432c8fa92e.tar.xz
manaplus-349038b1af02729ef04b546826138b432c8fa92e.zip
Improve color.
-rw-r--r--src/gui/color.cpp34
-rw-r--r--src/gui/color.h11
2 files changed, 9 insertions, 36 deletions
diff --git a/src/gui/color.cpp b/src/gui/color.cpp
index aa9ffe840..2536e2947 100644
--- a/src/gui/color.cpp
+++ b/src/gui/color.cpp
@@ -78,9 +78,9 @@ Color::Color() :
}
Color::Color(const unsigned int color) :
- r((color >> 16) & 0xFF),
- g((color >> 8) & 0xFF),
- b(color & 0xFF),
+ r((color >> 16) & 0xFFU),
+ g((color >> 8) & 0xFFU),
+ b(color & 0xFFU),
a(255U)
{
}
@@ -113,9 +113,9 @@ Color Color::operator+(const Color& color) const
Color Color::operator-(const Color& color) const
{
Color result(r - color.r,
- g - color.g,
- b - color.b,
- 255U);
+ g - color.g,
+ b - color.b,
+ 255U);
result.r = (result.r > 255U ? 255U : result.r);
result.g = (result.g > 255U ? 255U : result.g);
@@ -127,9 +127,9 @@ Color Color::operator-(const Color& color) const
Color Color::operator*(const float value) const
{
Color result(static_cast<int>(static_cast<float>(r) * value),
- static_cast<int>(static_cast<float>(g) * value),
- static_cast<int>(static_cast<float>(b) * value),
- a);
+ static_cast<int>(static_cast<float>(g) * value),
+ static_cast<int>(static_cast<float>(b) * value),
+ a);
result.r = (result.r > 255U ? 255U : result.r);
result.g = (result.g > 255U ? 255U : result.g);
@@ -147,19 +147,3 @@ bool Color::operator!=(const Color& color) const
{
return !(r == color.r && g == color.g && b == color.b && a == color.a);
}
-
-std::ostream& operator<<(std::ostream& out,
- const Color& color)
-{
- out << "Color [r = "
- << color.r
- << ", g = "
- << color.g
- << ", b = "
- << color.b
- << ", a = "
- << color.a
- << "]";
-
- return out;
-}
diff --git a/src/gui/color.h b/src/gui/color.h
index db8fda970..bfa66b796 100644
--- a/src/gui/color.h
+++ b/src/gui/color.h
@@ -64,8 +64,6 @@
#ifndef GUI_COLOR_H
#define GUI_COLOR_H
-#include <iostream>
-
#include "localconsts.h"
/**
@@ -160,15 +158,6 @@ class Color final
bool operator!=(const Color& color) const;
/**
- * Output operator for output.
- *
- * @param out The stream to output to.
- * @param color The color to output.
- */
- friend std::ostream& operator<<(std::ostream& out,
- const Color& Color);
-
- /**
* Holds the red color component (range 0-255).
*/
unsigned int r;