62 : fOuterOptions(outerOptions.
begin(), outerOptions.
end())
63 , fInnerOptions(innerOptions.
begin(), innerOptions.
end()) {
66 for (
const auto& outerOption : fOuterOptions) {
67 fNumOuterCombos += outerOption ? outerOption->priv().numCombinations() : 1;
71 for (
const auto& innerOption : fInnerOptions) {
72 fNumInnerCombos += innerOption ? innerOption->priv().numCombinations() : 1;
77 int numChildCombinations()
const override {
return fNumOuterCombos * fNumInnerCombos; }
79 void addToKey(
const KeyContext& keyContext,
81 PipelineDataGatherer* gatherer,
82 int desiredCombination)
const override {
85 const int desiredOuterCombination = desiredCombination % fNumOuterCombos;
86 int remainingCombinations = desiredCombination / fNumOuterCombos;
88 const int desiredInnerCombination = remainingCombinations % fNumInnerCombos;
89 remainingCombinations /= fNumInnerCombos;
94 int innerChildOptions, outerChildOptions;
96 std::tie(outer, outerChildOptions) = SelectOption<PrecompileColorFilter>(
97 fOuterOptions, desiredOuterCombination);
98 std::tie(inner, innerChildOptions) = SelectOption<PrecompileColorFilter>(
99 fInnerOptions, desiredInnerCombination);
101 if (!inner && !outer) {
105 outer->priv().addToKey(keyContext,
builder, gatherer, outerChildOptions);
107 inner->priv().addToKey(keyContext,
builder, gatherer, innerChildOptions);
111 inner->priv().addToKey(keyContext,
builder, gatherer, innerChildOptions);
114 outer->priv().addToKey(keyContext,
builder, gatherer, outerChildOptions);
119 std::vector<sk_sp<PrecompileColorFilter>> fOuterOptions;
120 std::vector<sk_sp<PrecompileColorFilter>> fInnerOptions;
133 return sk_make_sp<PrecompileComposeColorFilter>(outerOptions, innerOptions);
145 int desiredCombination)
const override {
156 return sk_make_sp<PrecompileBlendModeColorFilter>();
164 int desiredCombination)
const override {
167 static constexpr float kIdentity[20] = { 1, 0, 0, 0, 0,
179 return sk_make_sp<PrecompileMatrixColorFilter>();
183 return sk_make_sp<PrecompileMatrixColorFilter>();
191 int desiredCombination)
const override {
203 return sk_make_sp<PrecompileColorSpaceXformColorFilter>();
207 return sk_make_sp<PrecompileColorSpaceXformColorFilter>();
211 return sk_make_sp<PrecompileColorSpaceXformColorFilter>();
219 if (dstOptions.empty() && srcOptions.empty()) {
229 combos.
reserve(dstOptions.size() * srcOptions.size());
237 for (
const std::array<const PrecompileChildPtr, 2>& combo : combos) {
249 int desiredCombination)
const override {
259 return sk_make_sp<PrecompileTableColorFilter>();
300 int desiredCombination)
const override {
308 return sk_make_sp<PrecompileGaussianColorFilter>();
315 : fChildOptions(childOptions.
begin(), childOptions.
end()) {
318 for (
const auto& childOption : fChildOptions) {
319 fNumChildCombos += childOption->priv().numCombinations();
324 int numChildCombinations()
const override {
return fNumChildCombos; }
326 void addToKey(
const KeyContext& keyContext,
327 PaintParamsKeyBuilder*
builder,
328 PipelineDataGatherer* gatherer,
329 int desiredCombination)
const override {
330 SkASSERT(desiredCombination < fNumChildCombos);
333 ColorSpaceTransformBlock::ColorSpaceTransformData csData(
sk_srgb_singleton(), kAlphaType,
349 AddToKey<PrecompileColorFilter>(keyContext,
builder, gatherer,
350 fChildOptions, desiredCombination);
359 std::vector<sk_sp<PrecompileColorFilter>> fChildOptions;
366 return sk_make_sp<PrecompileWithWorkingFormatColorFilter>(childOptions);
static void is_empty(skiatest::Reporter *reporter, const SkPath &p)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kSrcOver
r = s + (1-sa)*d
constexpr SkPMColor4f SK_PMColor4fWHITE
SkColorSpace * sk_srgb_singleton()
sk_sp< T > sk_ref_sp(T *obj)
int numCombinations() const
PrecompileBlendModeColorFilter()
sk_sp< PrecompileColorFilter > makeComposed(sk_sp< PrecompileColorFilter > inner) const
~PrecompileColorFilter() override
PrecompileComposeColorFilter(SkSpan< const sk_sp< PrecompileColorFilter > > outerOptions, SkSpan< const sk_sp< PrecompileColorFilter > > innerOptions)
static const char * begin(const StringSlice &s)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static const FlSetting kHighContrast
const SkRuntimeEffect * GetKnownRuntimeEffect(StableKey stableKey)
sk_sp< PrecompileColorFilter > WithWorkingFormat(SkSpan< const sk_sp< PrecompileColorFilter > > childOptions)
sk_sp< PrecompileColorFilter > Gaussian()
sk_sp< PrecompileColorFilter > ColorSpaceXform()
SK_API sk_sp< PrecompileColorFilter > HSLAMatrix()
SK_API sk_sp< PrecompileColorFilter > Blend()
SK_API sk_sp< PrecompileColorFilter > Matrix()
SK_API sk_sp< PrecompileColorFilter > Overdraw()
SK_API sk_sp< PrecompileColorFilter > Lighting()
SK_API sk_sp< PrecompileColorFilter > Luma()
SK_API sk_sp< PrecompileColorFilter > Compose(SkSpan< const sk_sp< PrecompileColorFilter > > outer, SkSpan< const sk_sp< PrecompileColorFilter > > inner)
SK_API sk_sp< PrecompileColorFilter > HighContrast()
SK_API sk_sp< PrecompileColorFilter > SRGBToLinearGamma()
SK_API sk_sp< PrecompileColorFilter > LinearToSRGBGamma()
SK_API sk_sp< PrecompileColorFilter > Table()
SK_API sk_sp< PrecompileColorFilter > Lerp(SkSpan< const sk_sp< PrecompileColorFilter > > dstOptions, SkSpan< const sk_sp< PrecompileColorFilter > > srcOptions)
void AddBlendModeColorFilter(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, SkBlendMode bm, const SkPMColor4f &srcColor)
void Compose(const KeyContext &keyContext, PaintParamsKeyBuilder *keyBuilder, PipelineDataGatherer *gatherer, AddToKeyFn addInnerToKey, AddToKeyFn addOuterToKey)
sk_sp< PrecompileColorFilter > MakePrecompileColorFilter(sk_sp< SkRuntimeEffect > effect, SkSpan< const PrecompileChildOptions > childOptions)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const MatrixColorFilterData &)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const TableColorFilterData &)
std::shared_ptr< const fml::Mapping > data