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

Unified Diff: tools/bench_record.cpp

Issue 206313003: SkRecord strawman (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: IsSmall -> IsLarge: pithier Created 6 years, 9 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 | « src/record/SkRecords.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bench_record.cpp
diff --git a/tools/bench_record.cpp b/tools/bench_record.cpp
index cc8cc0e39de1597c6a1f84af29dc9979eb5025bc..db0ea9b71fe54cea6a457a6280c31dd926d1f0fb 100644
--- a/tools/bench_record.cpp
+++ b/tools/bench_record.cpp
@@ -11,6 +11,7 @@
#include "SkOSFile.h"
#include "SkPicture.h"
#include "SkQuadTreePicture.h"
+#include "SkRecorder.h"
#include "SkStream.h"
#include "SkString.h"
#include "SkTileGridPicture.h"
@@ -30,6 +31,7 @@ DEFINE_bool(endRecording, true, "If false, don't time SkPicture::endRecording()"
DEFINE_int32(nullSize, 1000, "Pretend dimension of null source picture.");
DEFINE_int32(tileGridSize, 512, "Set the tile grid size. Has no effect if bbh is not set to tilegrid.");
DEFINE_string(bbh, "", "Turn on the bbh and select the type, one of rtree, tilegrid, quadtree");
+DEFINE_bool(skr, false, "Record SKR instead of SKP.");
typedef SkPicture* (*PictureFactory)(const int width, const int height, int* recordingFlags);
@@ -75,14 +77,22 @@ static void bench_record(SkPicture* src, const char* name, PictureFactory pictur
const int height = src ? src->height() : FLAGS_nullSize;
for (int i = 0; i < FLAGS_loops; i++) {
- int recordingFlags = FLAGS_flags;
- SkAutoTUnref<SkPicture> dst(pictureFactory(width, height, &recordingFlags));
- SkCanvas* canvas = dst->beginRecording(width, height, recordingFlags);
- if (NULL != src) {
- src->draw(canvas);
- }
- if (FLAGS_endRecording) {
- dst->endRecording();
+ if (FLAGS_skr) {
+ SkRecord record;
+ SkRecorder canvas(&record, width, height);
+ if (NULL != src) {
+ src->draw(&canvas);
+ }
+ } else {
+ int recordingFlags = FLAGS_flags;
+ SkAutoTUnref<SkPicture> dst(pictureFactory(width, height, &recordingFlags));
+ SkCanvas* canvas = dst->beginRecording(width, height, recordingFlags);
+ if (NULL != src) {
+ src->draw(canvas);
+ }
+ if (FLAGS_endRecording) {
+ dst->endRecording();
+ }
}
}
« no previous file with comments | « src/record/SkRecords.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698