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

Side by Side Diff: dm/DMSrcSink.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 unified diff | Download patch
« no previous file with comments | « bench/nanobench.cpp ('k') | experimental/svg/model/SkSVGDOM.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkAndroidCodec.h" 10 #include "SkAndroidCodec.h"
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 static const SkSize kSVGSize = SkSize::Make(1000, 1000); 1036 static const SkSize kSVGSize = SkSize::Make(1000, 1000);
1037 1037
1038 SVGSrc::SVGSrc(Path path) : fPath(path) {} 1038 SVGSrc::SVGSrc(Path path) : fPath(path) {}
1039 1039
1040 Error SVGSrc::draw(SkCanvas* canvas) const { 1040 Error SVGSrc::draw(SkCanvas* canvas) const {
1041 SkFILEStream stream(fPath.c_str()); 1041 SkFILEStream stream(fPath.c_str());
1042 if (!stream.isValid()) { 1042 if (!stream.isValid()) {
1043 return SkStringPrintf("Unable to open file: %s", fPath.c_str()); 1043 return SkStringPrintf("Unable to open file: %s", fPath.c_str());
1044 } 1044 }
1045 1045
1046 sk_sp<SkSVGDOM> dom = SkSVGDOM::MakeFromStream(stream, kSVGSize); 1046 sk_sp<SkSVGDOM> dom = SkSVGDOM::MakeFromStream(stream);
1047 if (!dom) { 1047 if (!dom) {
1048 return SkStringPrintf("Unable to parse file: %s", fPath.c_str()); 1048 return SkStringPrintf("Unable to parse file: %s", fPath.c_str());
1049 } 1049 }
1050 1050
1051 dom->setContainerSize(kSVGSize);
1051 dom->render(canvas); 1052 dom->render(canvas);
1052 1053
1053 return ""; 1054 return "";
1054 } 1055 }
1055 1056
1056 SkISize SVGSrc::size() const { 1057 SkISize SVGSrc::size() const {
1057 return kSVGSize.toRound(); 1058 return kSVGSize.toRound();
1058 } 1059 }
1059 1060
1060 Name SVGSrc::name() const { return SkOSPath::Basename(fPath.c_str()); } 1061 Name SVGSrc::name() const { return SkOSPath::Basename(fPath.c_str()); }
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 Error err = src.draw(&rec); 1662 Error err = src.draw(&rec);
1662 if (!err.isEmpty()) { 1663 if (!err.isEmpty()) {
1663 return err; 1664 return err;
1664 } 1665 }
1665 dl->draw(canvas); 1666 dl->draw(canvas);
1666 return check_against_reference(bitmap, src, fSink); 1667 return check_against_reference(bitmap, src, fSink);
1667 }); 1668 });
1668 } 1669 }
1669 1670
1670 } // namespace DM 1671 } // namespace DM
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | experimental/svg/model/SkSVGDOM.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698