Update bench to be able to preprocess skps
This allows benchmarking of optimization improvements and plumbs in the purging API. The purging is necessary so we don't magically get faster because the saveLayers are always pre-generated.
R=jvanverth@google.com, reed@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/233663002
git-svn-id: http://skia.googlecode.com/svn/trunk@14154 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/PictureBenchmark.cpp b/tools/PictureBenchmark.cpp
index 3cc3415..62369a4 100644
--- a/tools/PictureBenchmark.cpp
+++ b/tools/PictureBenchmark.cpp
@@ -23,6 +23,7 @@
, fTimerTypes(0)
, fTimeIndividualTiles(false)
, fPurgeDecodedTex(false)
+, fPreprocess(false)
{}
PictureBenchmark::~PictureBenchmark() {
@@ -77,9 +78,22 @@
// We throw this away to remove first time effects (such as paging in this program)
fRenderer->setup();
+
+ if (fPreprocess) {
+ if (NULL != fRenderer->getCanvas()) {
+ fRenderer->getCanvas()->EXPERIMENTAL_optimize(pict);
+ }
+ }
+
fRenderer->render(NULL);
fRenderer->resetState(true); // flush, swapBuffers and Finish
+ if (fPreprocess) {
+ if (NULL != fRenderer->getCanvas()) {
+ fRenderer->getCanvas()->EXPERIMENTAL_purge(pict);
+ }
+ }
+
if (fPurgeDecodedTex) {
fRenderer->purgeTextures();
}
@@ -216,6 +230,12 @@
SkAssertResult(perRunTimerData.appendTimes(perRunTimer.get()));
+ if (fPreprocess) {
+ if (NULL != fRenderer->getCanvas()) {
+ fRenderer->getCanvas()->EXPERIMENTAL_purge(pict);
+ }
+ }
+
if (fPurgeDecodedTex) {
fRenderer->purgeTextures();
}