Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
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 clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
Definition: SkCanvas.cpp:1705
int save()
Definition: SkCanvas.cpp:447
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
Definition: color_source.cc:38
SkRRect rrect
Definition: SkRecords.h:232