skia2/bench/PictureOverheadBench.cpp
Mike Klein a705cb93c7 remove SkLiteDL
It's been dead code since it was inlined into Android last summer.

Change-Id: I252f6392d9436ef357f22a54bab8a33c9d1b3ea9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213625
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-05-14 18:55:44 +00:00

43 lines
1.2 KiB
C++

/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "bench/Benchmark.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPictureRecorder.h"
#include "include/core/SkRRect.h"
class ClipOverheadRecordingBench : public Benchmark {
public:
ClipOverheadRecordingBench() {}
private:
const char* onGetName() override { return "clip_overhead_recording"; }
bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
void onDraw(int loops, SkCanvas*) override {
SkPictureRecorder rec;
for (int i = 0; i < loops; i++) {
SkCanvas* canvas = rec.beginRecording({0,0, 2000,3000});
SkPaint paint;
SkRRect rrect;
rrect.setOval({0, 0, 1000, 1000});
for (int i = 0; i < 1000; i++) {
canvas->save();
canvas->translate(10, 10);
canvas->clipRect({10,10, 1000, 1000});
canvas->drawRRect(rrect, paint);
canvas->restore();
}
(void)rec.finishRecordingAsPicture();
}
}
};
DEF_BENCH( return new ClipOverheadRecordingBench; )