24 return std::move(input);
36 if (shader &&
color.fA < 1.f) {
43 if (
paint.getColorFilter()) {
51const SkSVGFilterContext::Result* SkSVGFilterContext::findResultById(
53 return fResults.find(
id);
57 const Result* res =
nullptr;
59 res = fResults.find(input.
id());
61 res = &fPreviousResult;
63 return res ? res->fFilterSubregion : fFilterEffectsRegion;
71 fResults[
id] = {
result, subregion, resultColorspace};
77 fPreviousResult = {
result, subregion, resultColorspace};
81 return fPreviousResult.fImageFilter ==
nullptr;
85std::tuple<sk_sp<SkImageFilter>,
SkSVGColorspace> SkSVGFilterContext::getInput(
89 switch (inputType.
type()) {
92 m.setScale(0, 0, 0, 1.0f);
101 if (fillPaint.isValid()) {
112 if (strokePaint.isValid()) {
120 const Result* res = findResultById(inputType.
id());
122 result = res->fImageFilter;
123 inputCS = res->fColorspace;
128 result = fPreviousResult.fImageFilter;
129 inputCS = fPreviousResult.fColorspace;
133 SkDebugf(
"unhandled filter input type %d\n", (
int)inputType.
type());
142 return std::get<1>(this->getInput(ctx, inputType));
147 return std::get<0>(this->getInput(ctx, inputType));
153 auto [
result, inputCS] = this->getInput(ctx, inputType);
154 return ConvertFilterColorspace(std::move(
result), inputCS, colorspace);
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > SRGBToLinearGamma()
static sk_sp< SkColorFilter > LinearToSRGBGamma()
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Shader(sk_sp< SkShader > shader, const CropRect &cropRect={})
SkSVGColorspace resolveInputColorspace(const SkSVGRenderContext &, const SkSVGFeInputType &) const
void registerResult(const SkSVGStringType &, const sk_sp< SkImageFilter > &, const SkRect &, SkSVGColorspace)
sk_sp< SkImageFilter > resolveInput(const SkSVGRenderContext &, const SkSVGFeInputType &) const
void setPreviousResult(const sk_sp< SkImageFilter > &, const SkRect &, SkSVGColorspace)
bool previousResultIsSourceGraphic() const
const SkRect & filterPrimitiveSubregion(const SkSVGFeInputType &) const
SkTLazy< SkPaint > fillPaint() const
SkTLazy< SkPaint > strokePaint() const
sk_sp< SkShader > makeWithColorFilter(sk_sp< SkColorFilter >) const
SK_API sk_sp< SkShader > Color(SkColor)
const myers::Point & get< 1 >(const myers::Segment &s)
const myers::Point & get< 0 >(const myers::Segment &s)