[svg] Handle std input case for filter subregion calculation
From the spec [1], if any inputs of a filter are one of the standard inputs (SourceGraphic, FillPaint, etc. -- anything except another filter), then the default filter primitive subregion is equal to the filter effect region. [1] https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion Bug: skia:10841 Change-Id: I70632e5119861c46c9e48af944d2c7cfdfc3c351 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354119 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Tyler Denniston <tdenniston@google.com>
This commit is contained in:
parent
3df6c20a05
commit
94730febf9
@ -45,6 +45,15 @@ SkRect SkSVGFe::resolveBoundaries(const SkSVGRenderContext& ctx,
|
||||
return boundaries;
|
||||
}
|
||||
|
||||
static bool AnyIsStandardInput(const std::vector<SkSVGFeInputType>& inputs) {
|
||||
for (const auto& in : inputs) {
|
||||
if (in.type() != SkSVGFeInputType::Type::kFilterPrimitiveReference) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
SkRect SkSVGFe::resolveFilterSubregion(const SkSVGRenderContext& ctx,
|
||||
const SkSVGFilterContext& fctx) const {
|
||||
// From https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion,
|
||||
@ -54,7 +63,7 @@ SkRect SkSVGFe::resolveFilterSubregion(const SkSVGRenderContext& ctx,
|
||||
// (https://www.w3.org/TR/SVG11/filters.html#FilterEffectsRegion).
|
||||
const std::vector<SkSVGFeInputType> inputs = this->getInputs();
|
||||
SkRect subregion;
|
||||
if (inputs.empty()) {
|
||||
if (inputs.empty() || AnyIsStandardInput(inputs)) {
|
||||
subregion = fctx.filterEffectsRegion();
|
||||
} else {
|
||||
subregion = fctx.filterPrimitiveSubregion(inputs[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user