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

Unified Diff: tools/bench_record.cpp

Issue 184543003: Adding flag to switch bench_record into tilegrid mode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Name changes Created 6 years, 10 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 | 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 cea3f0b6267ac34fcb4cfab0c55559bae11e0bcb..8faf81bbea7c58ba05d9c6dc6b95c3ae80f07caf 100644
--- a/tools/bench_record.cpp
+++ b/tools/bench_record.cpp
@@ -12,6 +12,7 @@
#include "SkPicture.h"
#include "SkStream.h"
#include "SkString.h"
+#include "SkTileGridPicture.h"
#include "SkTime.h"
__SK_FORCE_IMAGE_DECODER_LINKING;
@@ -25,6 +26,7 @@ DEFINE_int32(loops, 900, "Number of times to re-record each SKP.");
DEFINE_int32(flags, SkPicture::kUsePathBoundsForClip_RecordingFlag, "RecordingFlags to use.");
DEFINE_bool(endRecording, true, "If false, don't time SkPicture::endRecording()");
DEFINE_int32(nullSize, 1000, "Pretend dimension of null source picture.");
+DEFINE_int32(tileGridSize, 0, "Set the tile grid size, if non zero switches to tile grid picture and enables kOptimizeForClippedPlayback_RecordingFlag.");
static void bench_record(SkPicture* src, const char* name) {
const SkMSec start = SkTime::GetMSecs();
@@ -32,10 +34,21 @@ static void bench_record(SkPicture* src, const char* name) {
const int height = src ? src->height() : FLAGS_nullSize;
for (int i = 0; i < FLAGS_loops; i++) {
- SkPicture dst;
- SkCanvas* canvas = dst.beginRecording(width, height, FLAGS_flags);
+ SkAutoTUnref<SkPicture> dst;
+ int recordingFlags = FLAGS_flags;
+ if (FLAGS_tileGridSize > 0) {
+ SkTileGridPicture::TileGridInfo info;
+ info.fTileInterval.set(FLAGS_tileGridSize, FLAGS_tileGridSize);
+ info.fMargin.setEmpty();
+ info.fOffset.setZero();
+ dst.reset(SkNEW_ARGS(SkTileGridPicture, (width, height, info)));
+ recordingFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
+ } else {
+ dst.reset(SkNEW(SkPicture));
+ }
+ SkCanvas* canvas = dst->beginRecording(width, height, recordingFlags);
if (src) src->draw(canvas);
- if (FLAGS_endRecording) dst.endRecording();
+ if (FLAGS_endRecording) dst->endRecording();
}
const SkMSec elapsed = SkTime::GetMSecs() - start;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698