summaryrefslogtreecommitdiffhomepage
path: root/bench/bitmask.cpp
blob: 3fd4d77cf97c0c8fca051c9d74ae0bd8720c7425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#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 {

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)
        for (int i = 0; i < 10; i++)
            anim_atlas::make_bitmask_(img, bitmask);
}

BENCHMARK(Bitmask)->Unit(benchmark::kMillisecond);

} // namespace

} // namespace floormat