| 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 "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 "SkSVGCircle.h" | 13 #include "SkSVGCircle.h" |
| 14 #include "SkSVGDOM.h" | 14 #include "SkSVGDOM.h" |
| 15 #include "SkSVGEllipse.h" | 15 #include "SkSVGEllipse.h" |
| 16 #include "SkSVGG.h" | 16 #include "SkSVGG.h" |
| 17 #include "SkSVGLine.h" |
| 17 #include "SkSVGNode.h" | 18 #include "SkSVGNode.h" |
| 18 #include "SkSVGPath.h" | 19 #include "SkSVGPath.h" |
| 19 #include "SkSVGPoly.h" | 20 #include "SkSVGPoly.h" |
| 20 #include "SkSVGRect.h" | 21 #include "SkSVGRect.h" |
| 21 #include "SkSVGRenderContext.h" | 22 #include "SkSVGRenderContext.h" |
| 22 #include "SkSVGSVG.h" | 23 #include "SkSVGSVG.h" |
| 23 #include "SkSVGTypes.h" | 24 #include "SkSVGTypes.h" |
| 24 #include "SkSVGValue.h" | 25 #include "SkSVGValue.h" |
| 25 #include "SkTSearch.h" | 26 #include "SkTSearch.h" |
| 26 | 27 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 { "stroke" , { SkSVGAttribute::kStroke , SetPaintAttribute
}}, | 230 { "stroke" , { SkSVGAttribute::kStroke , SetPaintAttribute
}}, |
| 230 { "stroke-linecap" , { SkSVGAttribute::kStrokeLineCap , SetLineCapAttribute
}}, | 231 { "stroke-linecap" , { SkSVGAttribute::kStrokeLineCap , SetLineCapAttribute
}}, |
| 231 { "stroke-linejoin", { SkSVGAttribute::kStrokeLineJoin, SetLineJoinAttribute
}}, | 232 { "stroke-linejoin", { SkSVGAttribute::kStrokeLineJoin, SetLineJoinAttribute
}}, |
| 232 { "stroke-opacity" , { SkSVGAttribute::kStrokeOpacity , SetNumberAttribute
}}, | 233 { "stroke-opacity" , { SkSVGAttribute::kStrokeOpacity , SetNumberAttribute
}}, |
| 233 { "stroke-width" , { SkSVGAttribute::kStrokeWidth , SetLengthAttribute
}}, | 234 { "stroke-width" , { SkSVGAttribute::kStrokeWidth , SetLengthAttribute
}}, |
| 234 { "style" , { SkSVGAttribute::kUnknown , SetStyleAttributes
}}, | 235 { "style" , { SkSVGAttribute::kUnknown , SetStyleAttributes
}}, |
| 235 { "transform" , { SkSVGAttribute::kTransform , SetTransformAttribut
e }}, | 236 { "transform" , { SkSVGAttribute::kTransform , SetTransformAttribut
e }}, |
| 236 { "viewBox" , { SkSVGAttribute::kViewBox , SetViewBoxAttribute
}}, | 237 { "viewBox" , { SkSVGAttribute::kViewBox , SetViewBoxAttribute
}}, |
| 237 { "width" , { SkSVGAttribute::kWidth , SetLengthAttribute
}}, | 238 { "width" , { SkSVGAttribute::kWidth , SetLengthAttribute
}}, |
| 238 { "x" , { SkSVGAttribute::kX , SetLengthAttribute
}}, | 239 { "x" , { SkSVGAttribute::kX , SetLengthAttribute
}}, |
| 240 { "x1" , { SkSVGAttribute::kX1 , SetLengthAttribute
}}, |
| 241 { "x2" , { SkSVGAttribute::kX2 , SetLengthAttribute
}}, |
| 239 { "y" , { SkSVGAttribute::kY , SetLengthAttribute
}}, | 242 { "y" , { SkSVGAttribute::kY , SetLengthAttribute
}}, |
| 243 { "y1" , { SkSVGAttribute::kY1 , SetLengthAttribute
}}, |
| 244 { "y2" , { SkSVGAttribute::kY2 , SetLengthAttribute
}}, |
| 240 }; | 245 }; |
| 241 | 246 |
| 242 SortedDictionaryEntry<sk_sp<SkSVGNode>(*)()> gTagFactories[] = { | 247 SortedDictionaryEntry<sk_sp<SkSVGNode>(*)()> gTagFactories[] = { |
| 243 { "circle" , []() -> sk_sp<SkSVGNode> { return SkSVGCircle::Make(); }
}, | 248 { "circle" , []() -> sk_sp<SkSVGNode> { return SkSVGCircle::Make(); }
}, |
| 244 { "ellipse" , []() -> sk_sp<SkSVGNode> { return SkSVGEllipse::Make(); }
}, | 249 { "ellipse" , []() -> sk_sp<SkSVGNode> { return SkSVGEllipse::Make(); }
}, |
| 245 { "g" , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make(); }
}, | 250 { "g" , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make(); }
}, |
| 251 { "line" , []() -> sk_sp<SkSVGNode> { return SkSVGLine::Make(); }
}, |
| 246 { "path" , []() -> sk_sp<SkSVGNode> { return SkSVGPath::Make(); }
}, | 252 { "path" , []() -> sk_sp<SkSVGNode> { return SkSVGPath::Make(); }
}, |
| 247 { "polygon" , []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolygon(); }
}, | 253 { "polygon" , []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolygon(); }
}, |
| 248 { "polyline", []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolyline(); }
}, | 254 { "polyline", []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolyline(); }
}, |
| 249 { "rect" , []() -> sk_sp<SkSVGNode> { return SkSVGRect::Make(); }
}, | 255 { "rect" , []() -> sk_sp<SkSVGNode> { return SkSVGRect::Make(); }
}, |
| 250 { "svg" , []() -> sk_sp<SkSVGNode> { return SkSVGSVG::Make(); }
}, | 256 { "svg" , []() -> sk_sp<SkSVGNode> { return SkSVGSVG::Make(); }
}, |
| 251 }; | 257 }; |
| 252 | 258 |
| 253 struct ConstructionContext { | 259 struct ConstructionContext { |
| 254 ConstructionContext() : fParent(nullptr) { } | 260 ConstructionContext() : fParent(nullptr) { } |
| 255 ConstructionContext(const ConstructionContext& other, const sk_sp<SkSVGNode>
& newParent) | 261 ConstructionContext(const ConstructionContext& other, const sk_sp<SkSVGNode>
& newParent) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 366 } |
| 361 | 367 |
| 362 void SkSVGDOM::setContainerSize(const SkSize& containerSize) { | 368 void SkSVGDOM::setContainerSize(const SkSize& containerSize) { |
| 363 // TODO: inval | 369 // TODO: inval |
| 364 fContainerSize = containerSize; | 370 fContainerSize = containerSize; |
| 365 } | 371 } |
| 366 | 372 |
| 367 void SkSVGDOM::setRoot(sk_sp<SkSVGNode> root) { | 373 void SkSVGDOM::setRoot(sk_sp<SkSVGNode> root) { |
| 368 fRoot = std::move(root); | 374 fRoot = std::move(root); |
| 369 } | 375 } |
| OLD | NEW |