blob: 9b76885814a732299c51261412681db107116f6e [file] [log] [blame]
#include "../api/draw.h"
#include "../api/implicit_cast.h"
#include "slides.h"
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <memory>
using namespace eskia;
int main(int argc, char** argv) {
int w = argc > 1 ? atoi(argv[1]) : 400,
h = argc > 2 ? atoi(argv[2]) : 400;
auto buf = std::make_unique<RGBA_8888[]>(implicit_cast<size_t>(w*h));
Frame frame{buf.get(),
w,h, sizeof(RGBA_8888), w,
src_RGBA_8888, srcover_RGBA_8888};
for (auto it = slides; *it; it++) {
auto slide = *it;
Paint paint;
paint.color = RGBA_8888{255,255,255,255};
frame.draw({0,0,w,h}, paint, single_color, frame.src);
printf("%s", slide(nullptr));
std::chrono::duration<double, std::micro> elapsed;
int n = 0;
const auto start = std::chrono::steady_clock::now();
do {
slide(&frame);
elapsed = std::chrono::steady_clock::now() - start;
n++;
} while (elapsed < std::chrono::milliseconds(100));
printf("\t%gµs\n", elapsed.count() / n);
}
return 0;
}