| 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); |
| 35 return true; | 36 return true; |
| 36 } | 37 } |
| 37 | 38 |
| 38 void SkSVGNode::setAttribute(SkSVGAttribute attr, const SkSVGValue& v) { | 39 void SkSVGNode::setAttribute(SkSVGAttribute attr, const SkSVGValue& v) { |
| 39 this->onSetAttribute(attr, v); | 40 this->onSetAttribute(attr, v); |
| 40 } | 41 } |
| 41 | 42 |
| 42 void SkSVGNode::setFill(const SkSVGPaint& svgPaint) { | 43 void SkSVGNode::setFill(const SkSVGPaint& svgPaint) { |
| 43 fPresentationAttributes.fFill.set(svgPaint); | 44 fPresentationAttributes.fFill.set(svgPaint); |
| 44 } | 45 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 case SkSVGAttribute::kStrokeWidth: | 107 case SkSVGAttribute::kStrokeWidth: |
| 107 if (const SkSVGLengthValue* strokeWidth = v.as<SkSVGLengthValue>()) { | 108 if (const SkSVGLengthValue* strokeWidth = v.as<SkSVGLengthValue>()) { |
| 108 this->setStrokeWidth(*strokeWidth); | 109 this->setStrokeWidth(*strokeWidth); |
| 109 } | 110 } |
| 110 break; | 111 break; |
| 111 default: | 112 default: |
| 112 SkDebugf("attribute ID <%d> ignored for node <%d>\n", attr, fTag); | 113 SkDebugf("attribute ID <%d> ignored for node <%d>\n", attr, fTag); |
| 113 break; | 114 break; |
| 114 } | 115 } |
| 115 } | 116 } |
| OLD | NEW |