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

Side by Side Diff: experimental/svg/model/SkSVGDOM.cpp

Issue 2244223005: [SVGDom] Add <line> support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 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 unified diff | Download patch
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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkDOM.h" 9 #include "SkDOM.h"
10 #include "SkParsePath.h" 10 #include "SkParsePath.h"
11 #include "SkString.h" 11 #include "SkString.h"
12 #include "SkSVGAttributeParser.h" 12 #include "SkSVGAttributeParser.h"
13 #include "SkSVGDOM.h" 13 #include "SkSVGDOM.h"
14 #include "SkSVGG.h" 14 #include "SkSVGG.h"
15 #include "SkSVGLine.h"
15 #include "SkSVGNode.h" 16 #include "SkSVGNode.h"
16 #include "SkSVGPath.h" 17 #include "SkSVGPath.h"
17 #include "SkSVGPoly.h" 18 #include "SkSVGPoly.h"
18 #include "SkSVGRect.h" 19 #include "SkSVGRect.h"
19 #include "SkSVGRenderContext.h" 20 #include "SkSVGRenderContext.h"
20 #include "SkSVGSVG.h" 21 #include "SkSVGSVG.h"
21 #include "SkSVGTypes.h" 22 #include "SkSVGTypes.h"
22 #include "SkSVGValue.h" 23 #include "SkSVGValue.h"
23 #include "SkTSearch.h" 24 #include "SkTSearch.h"
24 25
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 { "stroke" , { SkSVGAttribute::kStroke , SetPaintAttribute }}, 225 { "stroke" , { SkSVGAttribute::kStroke , SetPaintAttribute }},
225 { "stroke-linecap" , { SkSVGAttribute::kStrokeLineCap , SetLineCapAttribute }}, 226 { "stroke-linecap" , { SkSVGAttribute::kStrokeLineCap , SetLineCapAttribute }},
226 { "stroke-linejoin", { SkSVGAttribute::kStrokeLineJoin, SetLineJoinAttribute }}, 227 { "stroke-linejoin", { SkSVGAttribute::kStrokeLineJoin, SetLineJoinAttribute }},
227 { "stroke-opacity" , { SkSVGAttribute::kStrokeOpacity , SetNumberAttribute }}, 228 { "stroke-opacity" , { SkSVGAttribute::kStrokeOpacity , SetNumberAttribute }},
228 { "stroke-width" , { SkSVGAttribute::kStrokeWidth , SetLengthAttribute }}, 229 { "stroke-width" , { SkSVGAttribute::kStrokeWidth , SetLengthAttribute }},
229 { "style" , { SkSVGAttribute::kUnknown , SetStyleAttributes }}, 230 { "style" , { SkSVGAttribute::kUnknown , SetStyleAttributes }},
230 { "transform" , { SkSVGAttribute::kTransform , SetTransformAttribut e }}, 231 { "transform" , { SkSVGAttribute::kTransform , SetTransformAttribut e }},
231 { "viewBox" , { SkSVGAttribute::kViewBox , SetViewBoxAttribute }}, 232 { "viewBox" , { SkSVGAttribute::kViewBox , SetViewBoxAttribute }},
232 { "width" , { SkSVGAttribute::kWidth , SetLengthAttribute }}, 233 { "width" , { SkSVGAttribute::kWidth , SetLengthAttribute }},
233 { "x" , { SkSVGAttribute::kX , SetLengthAttribute }}, 234 { "x" , { SkSVGAttribute::kX , SetLengthAttribute }},
235 { "x1" , { SkSVGAttribute::kX1 , SetLengthAttribute }},
236 { "x2" , { SkSVGAttribute::kX2 , SetLengthAttribute }},
234 { "y" , { SkSVGAttribute::kY , SetLengthAttribute }}, 237 { "y" , { SkSVGAttribute::kY , SetLengthAttribute }},
238 { "y1" , { SkSVGAttribute::kY1 , SetLengthAttribute }},
239 { "y2" , { SkSVGAttribute::kY2 , SetLengthAttribute }},
235 }; 240 };
236 241
237 SortedDictionaryEntry<sk_sp<SkSVGNode>(*)()> gTagFactories[] = { 242 SortedDictionaryEntry<sk_sp<SkSVGNode>(*)()> gTagFactories[] = {
238 { "g" , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make(); } }, 243 { "g" , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make(); } },
244 { "line" , []() -> sk_sp<SkSVGNode> { return SkSVGLine::Make(); } },
239 { "path" , []() -> sk_sp<SkSVGNode> { return SkSVGPath::Make(); } }, 245 { "path" , []() -> sk_sp<SkSVGNode> { return SkSVGPath::Make(); } },
240 { "polygon" , []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolygon(); } }, 246 { "polygon" , []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolygon(); } },
241 { "polyline", []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolyline(); } }, 247 { "polyline", []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolyline(); } },
242 { "rect" , []() -> sk_sp<SkSVGNode> { return SkSVGRect::Make(); } }, 248 { "rect" , []() -> sk_sp<SkSVGNode> { return SkSVGRect::Make(); } },
243 { "svg" , []() -> sk_sp<SkSVGNode> { return SkSVGSVG::Make(); } }, 249 { "svg" , []() -> sk_sp<SkSVGNode> { return SkSVGSVG::Make(); } },
244 }; 250 };
245 251
246 struct ConstructionContext { 252 struct ConstructionContext {
247 ConstructionContext() : fParent(nullptr) { } 253 ConstructionContext() : fParent(nullptr) { }
248 ConstructionContext(const ConstructionContext& other, const sk_sp<SkSVGNode> & newParent) 254 ConstructionContext(const ConstructionContext& other, const sk_sp<SkSVGNode> & newParent)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 359 }
354 360
355 void SkSVGDOM::setContainerSize(const SkSize& containerSize) { 361 void SkSVGDOM::setContainerSize(const SkSize& containerSize) {
356 // TODO: inval 362 // TODO: inval
357 fContainerSize = containerSize; 363 fContainerSize = containerSize;
358 } 364 }
359 365
360 void SkSVGDOM::setRoot(sk_sp<SkSVGNode> root) { 366 void SkSVGDOM::setRoot(sk_sp<SkSVGNode> root) {
361 fRoot = std::move(root); 367 fRoot = std::move(root);
362 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698