Lazy image decoding to reduce bench_record overhead.

We want bench_record to time recording only, and are willing to accept
some time spent playing back the source pictures only out of necessity.

This lets us skip the JPEG and PNG decoding, which are a pretty fair
chunk of time.  Should mean better record numbers at the same --loops.

BUG=skia:
R=tomhudson@chromium.org, halcanary@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/212563009

git-svn-id: http://skia.googlecode.com/svn/trunk@13977 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-03-28 16:08:18 +00:00
parent 28361fad10
commit 16182f74c6
2 changed files with 12 additions and 3 deletions

View File

@ -292,8 +292,15 @@
{
'target_name': 'bench_record',
'type': 'executable',
'sources': ['../tools/bench_record.cpp'],
'include_dirs': [ '../src/core/' ],
'sources': [
'../tools/bench_record.cpp',
'../tools/LazyDecodeBitmap.cpp',
],
'include_dirs': [
'../src/core/',
'../src/images',
'../src/lazy',
],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',

View File

@ -15,6 +15,7 @@
#include "SkString.h"
#include "SkTileGridPicture.h"
#include "SkTime.h"
#include "LazyDecodeBitmap.h"
__SK_FORCE_IMAGE_DECODER_LINKING;
@ -116,7 +117,8 @@ int tool_main(int argc, char** argv) {
failed = true;
continue;
}
SkAutoTUnref<SkPicture> src(SkPicture::CreateFromStream(stream));
SkAutoTUnref<SkPicture> src(
SkPicture::CreateFromStream(stream, sk_tools::LazyDecodeBitmap));
if (!src) {
SkDebugf("Could not read %s as an SkPicture.\n", path.c_str());
failed = true;