summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2022-01-27 13:38:28 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-02-06 17:52:33 +0000
commit3e135f347fce51d0a0d577afcf1f246f005b3b8f (patch)
tree42aa1078235c002a3834c329fc10bff5b4d01d2b /Userland/Applications/PixelPaint
parent9ba9691d1941443c4da61bdd0bc9e01978ed43e2 (diff)
downloadserenity-3e135f347fce51d0a0d577afcf1f246f005b3b8f.zip
Userland: Use AK::pow<I> where applicable
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp
index d90eaffad7..f0751723fa 100644
--- a/Userland/Applications/PixelPaint/ImageEditor.cpp
+++ b/Userland/Applications/PixelPaint/ImageEditor.cpp
@@ -12,6 +12,7 @@
#include "Layer.h"
#include "Tools/MoveTool.h"
#include "Tools/Tool.h"
+#include <AK/IntegralMath.h>
#include <AK/LexicalPath.h>
#include <LibConfig/Client.h>
#include <LibFileSystemAccessClient/Client.h>
@@ -218,14 +219,15 @@ int ImageEditor::calculate_ruler_step_size() const
const auto step_target = 80 / scale();
const auto max_factor = 5;
for (int factor = 0; factor < max_factor; ++factor) {
- if (step_target <= 1 * (float)pow(10, factor))
- return 1 * pow(10, factor);
- if (step_target <= 2 * (float)pow(10, factor))
- return 2 * pow(10, factor);
- if (step_target <= 5 * (float)pow(10, factor))
- return 5 * pow(10, factor);
+ int ten_to_factor = AK::pow<int>(10, factor);
+ if (step_target <= 1 * ten_to_factor)
+ return 1 * ten_to_factor;
+ if (step_target <= 2 * ten_to_factor)
+ return 2 * ten_to_factor;
+ if (step_target <= 5 * ten_to_factor)
+ return 5 * ten_to_factor;
}
- return 1 * pow(10, max_factor);
+ return AK::pow<int>(10, max_factor);
}
Gfx::IntRect ImageEditor::mouse_indicator_rect_x() const