diff options
author | 2014-08-29 08:03:56 -0700 | |
---|---|---|
committer | 2014-08-29 08:03:56 -0700 | |
commit | a8d7f0b13cd4c6d773fcf055fe17db75d260fa05 (patch) | |
tree | 37e85b212ccd5761b9a736282e75ebf838840798 /tools/bench_playback.cpp | |
parent | 77d724c07878b21602e96e095f6a446c429a079a (diff) |
Try out scalar picture sizes
This paves the way for removing the 'fTile' parameter from SkPictureShader (although that should be a different CL). If we like this we could also move to providing an entire cull SkRect.
R=reed@google.com, mtklein@google.com, fmalita@google.com, fmalita@chromium.org
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/513983002
Diffstat (limited to 'tools/bench_playback.cpp')
-rw-r--r-- | tools/bench_playback.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tools/bench_playback.cpp b/tools/bench_playback.cpp index f6c3ca4b1c..f5bbc12c0a 100644 --- a/tools/bench_playback.cpp +++ b/tools/bench_playback.cpp @@ -44,18 +44,23 @@ static SkPicture* rerecord(const SkPicture& src, bool skr) { SkTileGridFactory factory(info); SkPictureRecorder recorder; - src.draw(skr ? recorder.EXPERIMENTAL_beginRecording(src.width(), src.height(), &factory) - : recorder. DEPRECATED_beginRecording(src.width(), src.height(), &factory)); + src.draw(skr ? recorder.EXPERIMENTAL_beginRecording(src.cullRect().width(), + src.cullRect().height(), + &factory) + : recorder. DEPRECATED_beginRecording(src.cullRect().width(), + src.cullRect().height(), + &factory)); return recorder.endRecording(); } static void bench(SkPMColor* scratch, const SkPicture& src, const char* name) { SkAutoTUnref<const SkPicture> picture(rerecord(src, FLAGS_skr)); - SkAutoTDelete<SkCanvas> canvas(SkCanvas::NewRasterDirectN32(src.width(), - src.height(), - scratch, - src.width() * sizeof(SkPMColor))); + SkAutoTDelete<SkCanvas> canvas( + SkCanvas::NewRasterDirectN32(SkScalarCeilToInt(src.cullRect().width()), + SkScalarCeilToInt(src.cullRect().height()), + scratch, + SkScalarCeilToInt(src.cullRect().width()) * sizeof(SkPMColor))); canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLAGS_tile))); // Draw once to warm any caches. The first sample otherwise can be very noisy. @@ -121,9 +126,13 @@ int tool_main(int argc, char** argv) { continue; } - if (src->width() * src->height() > kMaxArea) { - SkDebugf("%s (%dx%d) is larger than hardcoded scratch bitmap (%dpx).\n", - path.c_str(), src->width(), src->height(), kMaxArea); + if (SkScalarCeilToInt(src->cullRect().width()) * + SkScalarCeilToInt(src->cullRect().height()) > kMaxArea) { + SkDebugf("%s (%f,%f,%f,%f) is larger than hardcoded scratch bitmap (%dpx).\n", + path.c_str(), + src->cullRect().fLeft, src->cullRect().fTop, + src->cullRect().fRight, src->cullRect().fBottom, + kMaxArea); failed = true; continue; } |