Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
PictureOverheadBench.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "bench/Benchmark.h"
13
15public:
17
18private:
19 const char* onGetName() override { return "clip_overhead_recording"; }
20 bool isSuitableFor(Backend backend) override { return backend == Backend::kNonRendering; }
21
22 void onDraw(int loops, SkCanvas*) override {
24
25 for (int loop = 0; loop < loops; loop++) {
26 SkCanvas* canvas = rec.beginRecording({0,0, 2000,3000});
27
29 SkRRect rrect;
30 rrect.setOval({0, 0, 1000, 1000});
31 for (int i = 0; i < 1000; i++) {
32 canvas->save();
33 canvas->translate(10, 10);
34 canvas->clipRect({10,10, 1000, 1000});
35 canvas->drawRRect(rrect, paint);
36 canvas->restore();
37 }
38
39 (void)rec.finishRecordingAsPicture();
40 }
41 }
42};
#define DEF_BENCH(code)
Definition Benchmark.h:20
const char * backend
void onDraw(int loops, SkCanvas *) override
bool isSuitableFor(Backend backend) override
const char * onGetName() override
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void restore()
Definition SkCanvas.cpp:465
void translate(SkScalar dx, SkScalar dy)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
int save()
Definition SkCanvas.cpp:451
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
void setOval(const SkRect &oval)
Definition SkRRect.cpp:30
const Paint & paint