summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/Color.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-03-21 02:23:44 +0100
committerAki <please@ignore.pl>2024-03-21 02:23:44 +0100
commitebbf3a75f9b0f6af7ebdc6a02a68c15378e77342 (patch)
treec1ae71d72382188738aa1f667a9bb23856fc1ccc /StarsEx/Color.cpp
parent1a6f1241eb85c82d4fddf7b61a867a1bb828992e (diff)
downloadstarshatter-ebbf3a75f9b0f6af7ebdc6a02a68c15378e77342.zip
starshatter-ebbf3a75f9b0f6af7ebdc6a02a68c15378e77342.tar.gz
starshatter-ebbf3a75f9b0f6af7ebdc6a02a68c15378e77342.tar.bz2
Removed Fixed Point Arithmetic implementation
This will bite me in near future, won't it? Add it back to FoundationEx at that point. Try handling it with some constepxr, too. Keywords for grep: fix-point, fixed-point, fast_f2i, IntMask, FractMask, fix::one, fix_sixty_five
Diffstat (limited to 'StarsEx/Color.cpp')
-rw-r--r--StarsEx/Color.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/StarsEx/Color.cpp b/StarsEx/Color.cpp
index 8c468dd..5ed6257 100644
--- a/StarsEx/Color.cpp
+++ b/StarsEx/Color.cpp
@@ -14,7 +14,6 @@
#include "Color.h"
#include "Video.h"
#include "Pcx.h"
-#include "Fix.h"
#include "Utils.h"
// +--------------------------------------------------------------------+
@@ -118,10 +117,10 @@ Color::operator*(const Color& c) const
Color
Color::operator*(double scale) const
{
- int r = fast_f2i(Red() * scale); if (r > 255) r = 255;
- int g = fast_f2i(Green() * scale); if (g > 255) g = 255;
- int b = fast_f2i(Blue() * scale); if (b > 255) b = 255;
- int a = fast_f2i(Alpha() * scale); if (a > 255) a = 255;
+ int r = static_cast<int>(Red() * scale); if (r > 255) r = 255;
+ int g = static_cast<int>(Green() * scale); if (g > 255) g = 255;
+ int b = static_cast<int>(Blue() * scale); if (b > 255) b = 255;
+ int a = static_cast<int>(Alpha() * scale); if (a > 255) a = 255;
return Color((BYTE) r, (BYTE) g, (BYTE) b, (BYTE) a);
}
@@ -129,9 +128,9 @@ Color::operator*(double scale) const
Color
Color::dim(double scale) const
{
- int r = fast_f2i(Red() * scale);
- int g = fast_f2i(Green() * scale);
- int b = fast_f2i(Blue() * scale);
+ int r = static_cast<int>(Red() * scale);
+ int g = static_cast<int>(Green() * scale);
+ int b = static_cast<int>(Blue() * scale);
return Color((BYTE) r, (BYTE) g, (BYTE) b, (BYTE) Alpha());
}