summaryrefslogtreecommitdiffhomepage
path: root/bench/bitmask.cpp
blob: 861f6ad7a6462fffa3fda482b47ac11799582614 (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);

    for (int i = 0; i < 3; i++)
        anim_atlas::make_bitmask_(img, bitmask);
    for (auto _ : state)
        anim_atlas::make_bitmask_(img, bitmask);
}

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

} // namespace

} // namespace floormat