/* * Copyright 2020 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "modules/svg/include/SkSVGFeOffset.h" #include "include/core/SkImageFilter.h" #include "include/core/SkM44.h" #include "include/effects/SkImageFilters.h" #include "modules/svg/include/SkSVGAttributeParser.h" #include "modules/svg/include/SkSVGFilterContext.h" #include "modules/svg/include/SkSVGRenderContext.h" #include bool SkSVGFeOffset::parseAndSetAttribute(const char* name, const char* value) { return INHERITED::parseAndSetAttribute(name, value) || this->setDx(SkSVGAttributeParser::parse("dx", name, value)) || this->setDy(SkSVGAttributeParser::parse("dy", name, value)); } sk_sp SkSVGFeOffset::onMakeImageFilter(const SkSVGRenderContext& ctx, const SkSVGFilterContext& fctx) const { const auto d = SkV2{this->getDx(), this->getDy()} * ctx.transformForCurrentOBB(fctx.primitiveUnits()).scale; sk_sp in = fctx.resolveInput(ctx, this->getIn(), this->resolveColorspace(ctx, fctx)); return SkImageFilters::Offset(d.x, d.y, std::move(in), this->resolveFilterSubregion(ctx, fctx)); }