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

Unified Diff: bench/nanobench.cpp

Issue 2345533002: [SVGDom] Expose intrinsic size info (Closed)
Patch Set: private intrinsicSize() Created 4 years, 3 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 | dm/DMSrcSink.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index ef22deeb429543716457e74be929d6a1717346fe..ca403f50deb53b1823eecde8f85b6959f42c1c5b 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -651,16 +651,21 @@ public:
return nullptr;
}
- // TODO: use intrinsic size? make tunable via flag?
- static const SkSize kContainerSize = SkSize::Make(128, 128);
- sk_sp<SkSVGDOM> svgDom = SkSVGDOM::MakeFromStream(stream, kContainerSize);
+ sk_sp<SkSVGDOM> svgDom = SkSVGDOM::MakeFromStream(stream);
if (!svgDom) {
SkDebugf("Could not parse %s.\n", path);
return nullptr;
}
+ // Use the intrinsic SVG size if available, otherwise fall back to a default value.
+ static const SkSize kDefaultContainerSize = SkSize::Make(128, 128);
+ if (svgDom->containerSize().isEmpty()) {
+ svgDom->setContainerSize(kDefaultContainerSize);
+ }
+
SkPictureRecorder recorder;
- svgDom->render(recorder.beginRecording(kContainerSize.width(), kContainerSize.height()));
+ svgDom->render(recorder.beginRecording(svgDom->containerSize().width(),
+ svgDom->containerSize().height()));
return recorder.finishRecordingAsPicture();
}
« no previous file with comments | « no previous file | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698