5#include "flutter/benchmarking/benchmarking.h"
13using CanvasCallback = size_t (*)(Canvas&);
15size_t DrawRect(Canvas& canvas) {
16 for (
auto i = 0;
i < 500;
i++) {
23size_t DrawCircle(Canvas& canvas) {
24 for (
auto i = 0;
i < 500;
i++) {
30size_t DrawLine(Canvas& canvas) {
31 for (
auto i = 0;
i < 500;
i++) {
41template <
class... Args>
43 auto args_tuple = std::make_tuple(std::move(
args)...);
44 auto test_proc = std::get<CanvasCallback>(args_tuple);
47 size_t canvas_count = 0u;
48 while (
state.KeepRunning()) {
55 state.counters[
"TotalOpCount"] = op_count;
56 state.counters[
"TotalCanvasCount"] = canvas_count;
static void test_proc(skiatest::Reporter *reporter, void(*proc)(skiatest::Reporter *, const SkRegion &a, const SkRegion &))
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static void draw_line(SkCanvas *canvas, SkImage *, const SkRect &r, sk_sp< SkImageFilter > imf)
BENCHMARK_CAPTURE(BM_CanvasRecord, draw_rect, &DrawRect)
static void BM_CanvasRecord(benchmark::State &state, Args &&... args)
static void draw_rect(SkCanvas *canvas, const SkRect &r, const SkPaint &p)
static constexpr Color DarkKhaki()
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)