summaryrefslogtreecommitdiffhomepage
path: root/bench/bitmask.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bench/bitmask.cpp')
-rw-r--r--bench/bitmask.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/bench/bitmask.cpp b/bench/bitmask.cpp
new file mode 100644
index 00000000..c8c698a6
--- /dev/null
+++ b/bench/bitmask.cpp
@@ -0,0 +1,27 @@
+#include "compat/assert.hpp"
+#include "src/anim-atlas.hpp"
+#include "loader/loader.hpp"
+#include <Corrade/Containers/Optional.h>
+#include <Magnum/Math/Functions.h>
+#include <Magnum/Trade/ImageData.h>
+#include <benchmark/benchmark.h>
+
+namespace floormat {
+
+namespace {
+
+[[maybe_unused]] void Bitmask(benchmark::State& state)
+{
+ auto img = loader.texture(loader.SCENERY_PATH, "door-close"_s);
+ auto bitmask = anim_atlas::make_bitmask(img);
+ anim_atlas::make_bitmask_(img, bitmask);
+
+ for (auto _ : state)
+ anim_atlas::make_bitmask_(img, bitmask);
+}
+
+BENCHMARK(Bitmask)->Unit(benchmark::kMicrosecond)->ReportAggregatesOnly();
+
+} // namespace
+
+} // namespace floormat