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

Side by Side Diff: samplecode/SampleSVGFile.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 | « experimental/svg/model/SkSVGSVG.cpp ('k') | samplecode/SampleSVGPong.cpp » ('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 2016 Google Inc. 2 * Copyright 2016 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDOM.h" 10 #include "SkDOM.h"
(...skipping 17 matching lines...) Expand all
28 SkDebugf("file not found: \"path\"\n", fPath.c_str()); 28 SkDebugf("file not found: \"path\"\n", fPath.c_str());
29 return; 29 return;
30 } 30 }
31 31
32 SkDOM xmlDom; 32 SkDOM xmlDom;
33 if (!xmlDom.build(svgStream)) { 33 if (!xmlDom.build(svgStream)) {
34 SkDebugf("XML parsing failed: \"path\"\n", fPath.c_str()); 34 SkDebugf("XML parsing failed: \"path\"\n", fPath.c_str());
35 return; 35 return;
36 } 36 }
37 37
38 fDom = SkSVGDOM::MakeFromDOM(xmlDom, SkSize::Make(this->width(), this->h eight())); 38 fDom = SkSVGDOM::MakeFromDOM(xmlDom);
39 if (fDom) {
40 fDom->setContainerSize(SkSize::Make(this->width(), this->height()));
41 }
39 } 42 }
40 43
41 void onDrawContent(SkCanvas* canvas) override { 44 void onDrawContent(SkCanvas* canvas) override {
42 if (fDom) { 45 if (fDom) {
43 fDom->render(canvas); 46 fDom->render(canvas);
44 } 47 }
45 } 48 }
46 49
47 void onSizeChange() override { 50 void onSizeChange() override {
48 if (fDom) { 51 if (fDom) {
(...skipping 18 matching lines...) Expand all
67 70
68 typedef SampleView INHERITED; 71 typedef SampleView INHERITED;
69 }; 72 };
70 73
71 } // anonymous namespace 74 } // anonymous namespace
72 75
73 SampleView* CreateSampleSVGFileView(const SkString& filename); 76 SampleView* CreateSampleSVGFileView(const SkString& filename);
74 SampleView* CreateSampleSVGFileView(const SkString& filename) { 77 SampleView* CreateSampleSVGFileView(const SkString& filename) {
75 return new SVGFileView(filename); 78 return new SVGFileView(filename);
76 } 79 }
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGSVG.cpp ('k') | samplecode/SampleSVGPong.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698