| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |