Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3068)

Unified Diff: bench/PictureOverheadBench.cpp

Issue 2213333002: SkLite* (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: annoying... Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PictureOverheadBench.cpp
diff --git a/bench/PictureOverheadBench.cpp b/bench/PictureOverheadBench.cpp
index fc72f8623add9f9946803bed1c5da1a3d91b18e7..3bd9fb0bd9e074cd1545a15b1218fb5e47efc77f 100644
--- a/bench/PictureOverheadBench.cpp
+++ b/bench/PictureOverheadBench.cpp
@@ -10,26 +10,53 @@
#include "Benchmark.h"
#include "SkCanvas.h"
+#include "SkLiteDL.h"
+#include "SkLiteRecorder.h"
#include "SkPictureRecorder.h"
-template <bool kDraw>
+template <int kDraws, bool kLite>
struct PictureOverheadBench : public Benchmark {
- const char* onGetName() override {
- return kDraw ? "picture_overhead_draw" : "picture_overhead_nodraw";
+ PictureOverheadBench() {
+ fName.appendf("picture_overhead_%d%s\n", kDraws, kLite ? "_lite" : "");
}
+ const char* onGetName() override { return fName.c_str(); }
bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
void onDraw(int loops, SkCanvas*) override {
+ SkLiteRecorder lite;
SkPictureRecorder rec;
for (int i = 0; i < loops; i++) {
- rec.beginRecording(SkRect::MakeWH(2000,3000));
- if (kDraw) {
- rec.getRecordingCanvas()->drawRect(SkRect::MakeXYWH(10, 10, 1000, 1000), SkPaint());
+ SkRect bounds{0,0, 2000,3000};
+
+ sk_sp<SkLiteDL> liteDL;
+ SkCanvas* canvas;
+ if (kLite) {
+ liteDL = SkLiteDL::New(bounds);
+ lite.reset(liteDL.get());
+ canvas = &lite;
+ } else {
+ rec.beginRecording(bounds);
+ canvas = rec.getRecordingCanvas();
+ }
+
+ for (int i = 0; i < kDraws; i++) {
+ canvas->drawRect({10,10, 1000, 1000}, SkPaint{});
+ }
+
+ if (!kLite) {
+ (void)rec.finishRecordingAsPicture();
}
- (void)rec.finishRecordingAsPicture();
}
}
+
+ SkString fName;
};
-DEF_BENCH(return (new PictureOverheadBench<false>);)
-DEF_BENCH(return (new PictureOverheadBench< true>);)
+DEF_BENCH(return (new PictureOverheadBench<0, false>);)
+DEF_BENCH(return (new PictureOverheadBench<1, false>);)
+DEF_BENCH(return (new PictureOverheadBench<2, false>);)
+DEF_BENCH(return (new PictureOverheadBench<10,false>);)
+DEF_BENCH(return (new PictureOverheadBench<0, true>);)
+DEF_BENCH(return (new PictureOverheadBench<1, true>);)
+DEF_BENCH(return (new PictureOverheadBench<2, true>);)
+DEF_BENCH(return (new PictureOverheadBench<10, true>);)
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698