41 static std::unique_ptr<GrFragmentProcessor>
Make(std::unique_ptr<GrFragmentProcessor>
src,
42 std::unique_ptr<GrFragmentProcessor>
dst,
44 bool shareBlendLogic) {
45 return std::unique_ptr<GrFragmentProcessor>(
49 const char*
name()
const override {
return "Blend"; }
51 std::unique_ptr<GrFragmentProcessor>
clone()
const override;
55 std::unique_ptr<GrFragmentProcessor>
dst,
60 , fShareBlendLogic(shareBlendLogic) {
69 , fShareBlendLogic(that.fShareBlendLogic) {}
71#if defined(GR_TEST_UTILS)
72 SkString onDumpInfo()
const override {
88 ~kConstantOutputForConstantInput_OptimizationFlag;
94 ~kConstantOutputForConstantInput_OptimizationFlag;
108 ~kConstantOutputForConstantInput_OptimizationFlag;
111 ~kConstantOutputForConstantInput_OptimizationFlag;
159 (!
src ||
src->hasConstantOutputForConstantInput()) &&
160 (!
dst ||
dst->hasConstantOutputForConstantInput())) {
167 if (fShareBlendLogic) {
170 b->add32((
int)fMode);
176 return fMode == cs.fMode;
189 std::unique_ptr<ProgramImpl> onMakeProgramImpl()
const override;
192 bool fShareBlendLogic;
204#if defined(GR_TEST_UTILS)
205std::unique_ptr<GrFragmentProcessor> BlendFragmentProcessor::TestCreate(GrProcessorTestData*
d) {
207 std::unique_ptr<GrFragmentProcessor>
src(GrProcessorUnitTest::MakeOptionalChildFP(
d));
209 if (
d->fRandom->nextBool()) {
212 bool shareLogic =
d->fRandom->nextBool();
216 return std::unique_ptr<GrFragmentProcessor>(
225std::unique_ptr<GrFragmentProcessor::ProgramImpl> BlendFragmentProcessor::onMakeProgramImpl()
229 void emitCode(EmitArgs&
args)
override {
238 if (bfp.fShareBlendLogic) {
241 args.fUniformHandler,
246 fragBuilder->
codeAppendf(
"return %s;", blendExpr.c_str());
259 if (bfp.fShareBlendLogic) {
264 UniformHandle fBlendUniform;
267 return std::make_unique<Impl>();
273 std::unique_ptr<GrFragmentProcessor>
src,
274 std::unique_ptr<GrFragmentProcessor>
dst,
276 bool shareBlendLogic) {
279 shareBlendLogic =
false;
static bool does_cpu_blend_impl_match_gpu(SkBlendMode mode)
#define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(...)
#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST
SkPMColor4f SkBlendMode_Apply(SkBlendMode mode, const SkPMColor4f &src, const SkPMColor4f &dst)
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLastSeparableMode
last blend mode operating separately on components
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kLastMode
last valid value
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
void swap(sk_sp< T > &a, sk_sp< T > &b)
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
static std::unique_ptr< GrFragmentProcessor > Make(std::unique_ptr< GrFragmentProcessor > src, std::unique_ptr< GrFragmentProcessor > dst, SkBlendMode mode, bool shareBlendLogic)
const char * name() const override
std::unique_ptr< GrFragmentProcessor > clone() const override
GrFragmentProcessor(ClassID classID, OptimizationFlags optimizationFlags)
static OptimizationFlags ProcessorOptimizationFlags(const GrFragmentProcessor *fp)
GrFragmentProcessor * childProcessor(int index)
void registerChild(std::unique_ptr< GrFragmentProcessor > child, SkSL::SampleUsage sampleUsage=SkSL::SampleUsage::PassThrough())
void setIsBlendFunction()
@ kNone_OptimizationFlags
@ kPreservesOpaqueInput_OptimizationFlag
@ kConstantOutputForConstantInput_OptimizationFlag
static SkPMColor4f ConstantOutputForConstantInput(const GrFragmentProcessor *fp, const SkPMColor4f &input)
void codeAppendf(const char format[],...) SK_PRINTF_LIKE(2
@ kBlendFragmentProcessor_ClassID
const char * c_str() const
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
std::unique_ptr< GrFragmentProcessor > Make(std::unique_ptr< GrFragmentProcessor > src, std::unique_ptr< GrFragmentProcessor > dst, SkBlendMode mode, bool shareBlendLogic=true)
GrFPResult MakeChildFP(const SkRuntimeEffect::ChildPtr &child, const GrFPArgs &childArgs)
std::string BlendExpression(const GrProcessor *processor, GrGLSLUniformHandler *uniformHandler, GrGLSLProgramDataManager::UniformHandle *blendUniform, const char *srcColor, const char *dstColor, SkBlendMode mode)
int BlendKey(SkBlendMode mode)
void SetBlendModeUniformData(const GrGLSLProgramDataManager &pdman, GrGLSLProgramDataManager::UniformHandle blendUniform, SkBlendMode mode)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
const myers::Point & get(const myers::Segment &)
const char * BlendFuncName(SkBlendMode mode)