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

Unified Diff: tools/bench_playback.cpp

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT again Created 6 years, 4 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 | « tools/bench_pictures_main.cpp ('k') | tools/bench_record.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bench_playback.cpp
diff --git a/tools/bench_playback.cpp b/tools/bench_playback.cpp
index f6c3ca4b1c98261b73f8c973062a77f69ad72aea..f5bbc12c0a999b3bf51ffeddc8b8fb65b28516d8 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;
}
« no previous file with comments | « tools/bench_pictures_main.cpp ('k') | tools/bench_record.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698