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

Unified Diff: bench/RecordingBench.cpp

Issue 2220273002: update picture recording benchmarks to allow comparison with SkLiteRecorder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more fair comparison this way 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 | « bench/RecordingBench.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/RecordingBench.cpp
diff --git a/bench/RecordingBench.cpp b/bench/RecordingBench.cpp
index 833bb229cc7ea9a5effae9e30c31584e3c7ef0d6..030bcc8415a5838fab7f61610aa0ddcfcdfb3e8f 100644
--- a/bench/RecordingBench.cpp
+++ b/bench/RecordingBench.cpp
@@ -6,14 +6,21 @@
*/
#include "RecordingBench.h"
-
#include "SkBBHFactory.h"
+#include "SkLiteDL.h"
+#include "SkLiteRecorder.h"
#include "SkPictureRecorder.h"
-RecordingBench::RecordingBench(const char* name, const SkPicture* pic, bool useBBH)
- : fSrc(SkRef(pic))
- , fName(name)
- , fUseBBH(useBBH) {}
+RecordingBench::RecordingBench(const char* name, const SkPicture* pic, bool useBBH, bool lite)
+ : fName(name)
+ , fUseBBH(useBBH)
+ , fLite(lite) {
+ // Flatten the source picture in case it's trivially nested (useless for timing).
+ SkPictureRecorder rec;
+ pic->playback(rec.beginRecording(pic->cullRect(), nullptr,
+ SkPictureRecorder::kPlaybackDrawPicture_RecordFlag));
+ fSrc = rec.finishRecordingAsPicture();
+}
const char* RecordingBench::onGetName() {
return fName.c_str();
@@ -29,14 +36,21 @@ SkIPoint RecordingBench::onGetSize() {
}
void RecordingBench::onDraw(int loops, SkCanvas*) {
- SkRTreeFactory factory;
- const SkScalar w = fSrc->cullRect().width(),
- h = fSrc->cullRect().height();
-
- uint32_t flags = SkPictureRecorder::kPlaybackDrawPicture_RecordFlag;
- for (int i = 0; i < loops; i++) {
+ if (fLite) {
+ SkLiteRecorder rec;
+ while (loops --> 0) {
+ sk_sp<SkLiteDL> dl = SkLiteDL::New(fSrc->cullRect());
+ rec.reset(dl.get());
+ fSrc->playback(&rec);
+ dl->makeThreadsafe();
+ }
+
+ } else {
+ SkRTreeFactory factory;
SkPictureRecorder recorder;
- fSrc->playback(recorder.beginRecording(w, h, fUseBBH ? &factory : nullptr, flags));
- (void)recorder.finishRecordingAsPicture();
+ while (loops --> 0) {
+ fSrc->playback(recorder.beginRecording(fSrc->cullRect(), fUseBBH ? &factory : nullptr));
+ (void)recorder.finishRecordingAsPicture();
+ }
}
}
« no previous file with comments | « bench/RecordingBench.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698