| * Copyright 2016 Google Inc. |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| #include "SkSVGRenderContext.h" |
| #include "SkSVGTransformableNode.h" |
| SkSVGTransformableNode::SkSVGTransformableNode(SkSVGTag tag) |
| , fTransform(SkMatrix::I()) { } |
| bool SkSVGTransformableNode::onPrepareToRender(SkSVGRenderContext* ctx) const { |
| if (!fTransform.value().isIdentity()) { |
| ctx->canvas()->concat(fTransform); |
| return this->INHERITED::onPrepareToRender(ctx); |
| void SkSVGTransformableNode::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) { |
| case SkSVGAttribute::kTransform: |
| if (const auto* transform = v.as<SkSVGTransformValue>()) { |
| this->setTransform(*transform); |
| this->INHERITED::onSetAttribute(attr, v); |
| void SkSVGTransformableNode::mapToParent(SkPath* path) const { |
| if (fTransform.value().isIdentity()) { |
| if (!fTransform.value().invert(&inv)) { |