| 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 "SkMatrix.h" | 9 #include "SkMatrix.h" |
| 10 #include "SkSVGNode.h" | 10 #include "SkSVGNode.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool SkSVGNode::asPaint(const SkSVGRenderContext& ctx, SkPaint* paint) const { | 27 bool SkSVGNode::asPaint(const SkSVGRenderContext& ctx, SkPaint* paint) const { |
| 28 SkSVGRenderContext localContext(ctx); | 28 SkSVGRenderContext localContext(ctx); |
| 29 | 29 |
| 30 return this->onPrepareToRender(&localContext) && this->onAsPaint(localContex
t, paint); | 30 return this->onPrepareToRender(&localContext) && this->onAsPaint(localContex
t, paint); |
| 31 } | 31 } |
| 32 | 32 |
| 33 bool SkSVGNode::onPrepareToRender(SkSVGRenderContext* ctx) const { | 33 bool SkSVGNode::onPrepareToRender(SkSVGRenderContext* ctx) const { |
| 34 ctx->applyPresentationAttributes(fPresentationAttributes, | 34 ctx->applyPresentationAttributes(fPresentationAttributes); |
| 35 this->hasChildren() ? 0 : SkSVGRenderContex
t::kLeaf); | |
| 36 return true; | 35 return true; |
| 37 } | 36 } |
| 38 | 37 |
| 39 void SkSVGNode::setAttribute(SkSVGAttribute attr, const SkSVGValue& v) { | 38 void SkSVGNode::setAttribute(SkSVGAttribute attr, const SkSVGValue& v) { |
| 40 this->onSetAttribute(attr, v); | 39 this->onSetAttribute(attr, v); |
| 41 } | 40 } |
| 42 | 41 |
| 43 void SkSVGNode::setFill(const SkSVGPaint& svgPaint) { | 42 void SkSVGNode::setFill(const SkSVGPaint& svgPaint) { |
| 44 fPresentationAttributes.fFill.set(svgPaint); | 43 fPresentationAttributes.fFill.set(svgPaint); |
| 45 } | 44 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 case SkSVGAttribute::kStrokeWidth: | 106 case SkSVGAttribute::kStrokeWidth: |
| 108 if (const SkSVGLengthValue* strokeWidth = v.as<SkSVGLengthValue>()) { | 107 if (const SkSVGLengthValue* strokeWidth = v.as<SkSVGLengthValue>()) { |
| 109 this->setStrokeWidth(*strokeWidth); | 108 this->setStrokeWidth(*strokeWidth); |
| 110 } | 109 } |
| 111 break; | 110 break; |
| 112 default: | 111 default: |
| 113 SkDebugf("attribute ID <%d> ignored for node <%d>\n", attr, fTag); | 112 SkDebugf("attribute ID <%d> ignored for node <%d>\n", attr, fTag); |
| 114 break; | 113 break; |
| 115 } | 114 } |
| 116 } | 115 } |
| OLD | NEW |