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

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

Issue 2339533002: [SVGDom] Linear gradient 'gradientTransform' support (Closed)
Patch Set: rebased 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/SkSVGAttribute.h ('k') | experimental/svg/model/SkSVGLinearGradient.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 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"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 const char* fKey; 244 const char* fKey;
245 const T fValue; 245 const T fValue;
246 }; 246 };
247 247
248 struct AttrParseInfo { 248 struct AttrParseInfo {
249 SkSVGAttribute fAttr; 249 SkSVGAttribute fAttr;
250 bool (*fSetter)(const sk_sp<SkSVGNode>& node, SkSVGAttribute attr, const cha r* stringValue); 250 bool (*fSetter)(const sk_sp<SkSVGNode>& node, SkSVGAttribute attr, const cha r* stringValue);
251 }; 251 };
252 252
253 SortedDictionaryEntry<AttrParseInfo> gAttributeParseInfo[] = { 253 SortedDictionaryEntry<AttrParseInfo> gAttributeParseInfo[] = {
254 { "cx" , { SkSVGAttribute::kCx , SetLengthAttribute }}, 254 { "cx" , { SkSVGAttribute::kCx , SetLengthAttrib ute }},
255 { "cy" , { SkSVGAttribute::kCy , SetLengthAttribute }}, 255 { "cy" , { SkSVGAttribute::kCy , SetLengthAttrib ute }},
256 { "d" , { SkSVGAttribute::kD , SetPathDataAttribute }}, 256 { "d" , { SkSVGAttribute::kD , SetPathDataAttr ibute }},
257 { "fill" , { SkSVGAttribute::kFill , SetPaintAttribute }}, 257 { "fill" , { SkSVGAttribute::kFill , SetPaintAttribu te }},
258 { "fill-opacity" , { SkSVGAttribute::kFillOpacity , SetNumberAttribute }}, 258 { "fill-opacity" , { SkSVGAttribute::kFillOpacity , SetNumberAttrib ute }},
259 { "height" , { SkSVGAttribute::kHeight , SetLengthAttribute }}, 259 { "gradientTransform", { SkSVGAttribute::kGradientTransform, SetTransformAtt ribute }},
260 { "offset" , { SkSVGAttribute::kOffset , SetLengthAttribute }}, 260 { "height" , { SkSVGAttribute::kHeight , SetLengthAttrib ute }},
261 { "opacity" , { SkSVGAttribute::kOpacity , SetNumberAttribute }}, 261 { "offset" , { SkSVGAttribute::kOffset , SetLengthAttrib ute }},
262 { "points" , { SkSVGAttribute::kPoints , SetPointsAttribute }}, 262 { "opacity" , { SkSVGAttribute::kOpacity , SetNumberAttrib ute }},
263 { "r" , { SkSVGAttribute::kR , SetLengthAttribute }}, 263 { "points" , { SkSVGAttribute::kPoints , SetPointsAttrib ute }},
264 { "rx" , { SkSVGAttribute::kRx , SetLengthAttribute }}, 264 { "r" , { SkSVGAttribute::kR , SetLengthAttrib ute }},
265 { "ry" , { SkSVGAttribute::kRy , SetLengthAttribute }}, 265 { "rx" , { SkSVGAttribute::kRx , SetLengthAttrib ute }},
266 { "spreadMethod" , { SkSVGAttribute::kSpreadMethod , SetSpreadMethodAttri bute }}, 266 { "ry" , { SkSVGAttribute::kRy , SetLengthAttrib ute }},
267 { "stop-color" , { SkSVGAttribute::kStopColor , SetColorAttribute }}, 267 { "spreadMethod" , { SkSVGAttribute::kSpreadMethod , SetSpreadMethod Attribute }},
268 { "stop-opacity" , { SkSVGAttribute::kStopOpacity , SetNumberAttribute }}, 268 { "stop-color" , { SkSVGAttribute::kStopColor , SetColorAttribu te }},
269 { "stroke" , { SkSVGAttribute::kStroke , SetPaintAttribute }}, 269 { "stop-opacity" , { SkSVGAttribute::kStopOpacity , SetNumberAttrib ute }},
270 { "stroke-linecap" , { SkSVGAttribute::kStrokeLineCap , SetLineCapAttribute }}, 270 { "stroke" , { SkSVGAttribute::kStroke , SetPaintAttribu te }},
271 { "stroke-linejoin", { SkSVGAttribute::kStrokeLineJoin, SetLineJoinAttribute }}, 271 { "stroke-linecap" , { SkSVGAttribute::kStrokeLineCap , SetLineCapAttri bute }},
272 { "stroke-opacity" , { SkSVGAttribute::kStrokeOpacity , SetNumberAttribute }}, 272 { "stroke-linejoin" , { SkSVGAttribute::kStrokeLineJoin , SetLineJoinAttr ibute }},
273 { "stroke-width" , { SkSVGAttribute::kStrokeWidth , SetLengthAttribute }}, 273 { "stroke-opacity" , { SkSVGAttribute::kStrokeOpacity , SetNumberAttrib ute }},
274 { "style" , { SkSVGAttribute::kUnknown , SetStyleAttributes }}, 274 { "stroke-width" , { SkSVGAttribute::kStrokeWidth , SetLengthAttrib ute }},
275 { "transform" , { SkSVGAttribute::kTransform , SetTransformAttribut e }}, 275 { "style" , { SkSVGAttribute::kUnknown , SetStyleAttribu tes }},
276 { "viewBox" , { SkSVGAttribute::kViewBox , SetViewBoxAttribute }}, 276 { "transform" , { SkSVGAttribute::kTransform , SetTransformAtt ribute }},
277 { "width" , { SkSVGAttribute::kWidth , SetLengthAttribute }}, 277 { "viewBox" , { SkSVGAttribute::kViewBox , SetViewBoxAttri bute }},
278 { "x" , { SkSVGAttribute::kX , SetLengthAttribute }}, 278 { "width" , { SkSVGAttribute::kWidth , SetLengthAttrib ute }},
279 { "x1" , { SkSVGAttribute::kX1 , SetLengthAttribute }}, 279 { "x" , { SkSVGAttribute::kX , SetLengthAttrib ute }},
280 { "x2" , { SkSVGAttribute::kX2 , SetLengthAttribute }}, 280 { "x1" , { SkSVGAttribute::kX1 , SetLengthAttrib ute }},
281 { "xlink:href" , { SkSVGAttribute::kHref , SetIRIAttribute }}, 281 { "x2" , { SkSVGAttribute::kX2 , SetLengthAttrib ute }},
282 { "y" , { SkSVGAttribute::kY , SetLengthAttribute }}, 282 { "xlink:href" , { SkSVGAttribute::kHref , SetIRIAttribute }},
283 { "y1" , { SkSVGAttribute::kY1 , SetLengthAttribute }}, 283 { "y" , { SkSVGAttribute::kY , SetLengthAttrib ute }},
284 { "y2" , { SkSVGAttribute::kY2 , SetLengthAttribute }}, 284 { "y1" , { SkSVGAttribute::kY1 , SetLengthAttrib ute }},
285 { "y2" , { SkSVGAttribute::kY2 , SetLengthAttrib ute }},
285 }; 286 };
286 287
287 SortedDictionaryEntry<sk_sp<SkSVGNode>(*)()> gTagFactories[] = { 288 SortedDictionaryEntry<sk_sp<SkSVGNode>(*)()> gTagFactories[] = {
288 { "circle" , []() -> sk_sp<SkSVGNode> { return SkSVGCircle::Make(); }}, 289 { "circle" , []() -> sk_sp<SkSVGNode> { return SkSVGCircle::Make(); }},
289 { "defs" , []() -> sk_sp<SkSVGNode> { return SkSVGDefs::Make(); }}, 290 { "defs" , []() -> sk_sp<SkSVGNode> { return SkSVGDefs::Make(); }},
290 { "ellipse" , []() -> sk_sp<SkSVGNode> { return SkSVGEllipse::Make(); }}, 291 { "ellipse" , []() -> sk_sp<SkSVGNode> { return SkSVGEllipse::Make(); }},
291 { "g" , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make(); }}, 292 { "g" , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make(); }},
292 { "line" , []() -> sk_sp<SkSVGNode> { return SkSVGLine::Make(); }}, 293 { "line" , []() -> sk_sp<SkSVGNode> { return SkSVGLine::Make(); }},
293 { "linearGradient", []() -> sk_sp<SkSVGNode> { return SkSVGLinearGradient::M ake(); }}, 294 { "linearGradient", []() -> sk_sp<SkSVGNode> { return SkSVGLinearGradient::M ake(); }},
294 { "path" , []() -> sk_sp<SkSVGNode> { return SkSVGPath::Make(); }}, 295 { "path" , []() -> sk_sp<SkSVGNode> { return SkSVGPath::Make(); }},
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 417 }
417 418
418 void SkSVGDOM::setContainerSize(const SkSize& containerSize) { 419 void SkSVGDOM::setContainerSize(const SkSize& containerSize) {
419 // TODO: inval 420 // TODO: inval
420 fContainerSize = containerSize; 421 fContainerSize = containerSize;
421 } 422 }
422 423
423 void SkSVGDOM::setRoot(sk_sp<SkSVGNode> root) { 424 void SkSVGDOM::setRoot(sk_sp<SkSVGNode> root) {
424 fRoot = std::move(root); 425 fRoot = std::move(root);
425 } 426 }
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGAttribute.h ('k') | experimental/svg/model/SkSVGLinearGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698