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

Unified Diff: bench/RecordingBench.cpp

Issue 2230323002: In recording benches, record to and from the same format. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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') | no next file » | 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 030bcc8415a5838fab7f61610aa0ddcfcdfb3e8f..d8034ce5d5f3cc174743a8b0ca28f3935ec90422 100644
--- a/bench/RecordingBench.cpp
+++ b/bench/RecordingBench.cpp
@@ -13,13 +13,20 @@
RecordingBench::RecordingBench(const char* name, const SkPicture* pic, bool useBBH, bool lite)
: fName(name)
- , fUseBBH(useBBH)
- , fLite(lite) {
+ , fUseBBH(useBBH) {
// 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();
+
+ // If we're recording into an SkLiteDL, also record _from_ one.
+ if (lite) {
+ fDL = SkLiteDL::New(pic->cullRect());
+ SkLiteRecorder r;
+ r.reset(fDL.get());
+ fSrc->playback(&r);
+ }
}
const char* RecordingBench::onGetName() {
@@ -36,12 +43,12 @@ SkIPoint RecordingBench::onGetSize() {
}
void RecordingBench::onDraw(int loops, SkCanvas*) {
- if (fLite) {
+ if (fDL) {
SkLiteRecorder rec;
while (loops --> 0) {
sk_sp<SkLiteDL> dl = SkLiteDL::New(fSrc->cullRect());
rec.reset(dl.get());
- fSrc->playback(&rec);
+ fDL->draw(&rec);
dl->makeThreadsafe();
}
« no previous file with comments | « bench/RecordingBench.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698