Remove GrBlendFragmentProcessor::BlendBehavior.
There is only one value for the enum. Bug: skia:10457 Change-Id: I46edd905c3a65ab5b398964ccd4f978b9b9737f9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425461 Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
9191e813a0
commit
4b6e2f0d88
@ -281,19 +281,15 @@ static void run(GrRecordingContext* rContext, GrSurfaceDrawContext* sdc, bool su
|
||||
sampler,
|
||||
caps);
|
||||
// Compose against white (default paint color)
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
/*dst=*/nullptr,
|
||||
SkBlendMode::kSrcOver,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp),
|
||||
/*dst=*/nullptr,
|
||||
SkBlendMode::kSrcOver);
|
||||
GrPaint paint;
|
||||
// Compose against white (default paint color) and then replace the dst
|
||||
// (SkBlendMode::kSrc).
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
/*dst=*/nullptr,
|
||||
SkBlendMode::kSrcOver,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp),
|
||||
/*dst=*/nullptr,
|
||||
SkBlendMode::kSrcOver);
|
||||
paint.setColorFragmentProcessor(std::move(fp));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
sdc->fillRectToRect(nullptr,
|
||||
@ -390,11 +386,9 @@ static void do_very_large_blur_gm(GrSurfaceDrawContext* sdc,
|
||||
if (result) {
|
||||
std::unique_ptr<GrFragmentProcessor> fp =
|
||||
GrTextureEffect::Make(std::move(result), kPremul_SkAlphaType);
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
/*dst=*/nullptr,
|
||||
SkBlendMode::kSrcOver,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp),
|
||||
/*dst=*/nullptr,
|
||||
SkBlendMode::kSrcOver);
|
||||
sdc->fillRectToRectWithFP(SkIRect::MakeSize(dstB.size()),
|
||||
dstRect,
|
||||
std::move(fp));
|
||||
|
@ -100,11 +100,7 @@ GrFPResult SkModeColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProc
|
||||
SkDEBUGCODE(const bool fpHasConstIO = !inputFP || inputFP->hasConstantOutputForConstantInput();)
|
||||
|
||||
auto colorFP = GrFragmentProcessor::MakeColor(SkColorToPMColor4f(fColor, dstColorInfo));
|
||||
auto xferFP = GrBlendFragmentProcessor::Make(
|
||||
std::move(colorFP),
|
||||
std::move(inputFP),
|
||||
fMode,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
auto xferFP = GrBlendFragmentProcessor::Make(std::move(colorFP), std::move(inputFP), fMode);
|
||||
|
||||
if (xferFP == nullptr) {
|
||||
// This is only expected to happen if the blend mode is "dest" and the input FP is null.
|
||||
|
@ -280,11 +280,7 @@ sk_sp<SkSpecialImage> SkBlendImageFilter::filterImageGPU(const Context& ctx,
|
||||
fgFP = GrColorSpaceXformEffect::Make(std::move(fgFP), foreground->getColorSpace(),
|
||||
foreground->alphaType(), ctx.colorSpace(),
|
||||
kPremul_SkAlphaType);
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fgFP),
|
||||
std::move(fp),
|
||||
fMode,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fgFP), std::move(fp), fMode);
|
||||
}
|
||||
|
||||
GrImageInfo info(ctx.grColorType(), kPremul_SkAlphaType, ctx.refColorSpace(), bounds.size());
|
||||
|
@ -1606,10 +1606,6 @@ GrFPResult GrClipStack::GetSWMaskFP(GrRecordingContext* context, Mask::Stack* ma
|
||||
fp = GrFragmentProcessor::DeviceSpace(std::move(fp));
|
||||
|
||||
// Must combine the coverage sampled from the texture effect with the previous coverage
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
std::move(clipFP),
|
||||
SkBlendMode::kDstIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp), std::move(clipFP), SkBlendMode::kDstIn);
|
||||
return GrFPSuccess(std::move(fp));
|
||||
}
|
||||
|
@ -82,11 +82,7 @@ static std::unique_ptr<GrFragmentProcessor> create_fp_for_mask(GrSurfaceProxyVie
|
||||
auto domain = subset.makeInset(0.5, 0.5);
|
||||
auto fp = GrTextureEffect::MakeSubset(std::move(mask), kPremul_SkAlphaType, m, samplerState,
|
||||
subset, domain, caps);
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
nullptr,
|
||||
SkBlendMode::kDstIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp), nullptr, SkBlendMode::kDstIn);
|
||||
return GrFragmentProcessor::DeviceSpace(std::move(fp));
|
||||
}
|
||||
|
||||
|
@ -225,11 +225,9 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulChildByInputAlpha(
|
||||
if (!fp) {
|
||||
return nullptr;
|
||||
}
|
||||
return GrBlendFragmentProcessor::Make(
|
||||
/*src=*/nullptr,
|
||||
OverrideInput(std::move(fp), SK_PMColor4fWHITE),
|
||||
SkBlendMode::kDstIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
return GrBlendFragmentProcessor::Make(/*src=*/nullptr,
|
||||
OverrideInput(std::move(fp), SK_PMColor4fWHITE),
|
||||
SkBlendMode::kDstIn);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulInputByChildAlpha(
|
||||
@ -237,31 +235,25 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulInputByChildAlpha(
|
||||
if (!fp) {
|
||||
return nullptr;
|
||||
}
|
||||
return GrBlendFragmentProcessor::Make(
|
||||
/*src=*/nullptr,
|
||||
OverrideInput(std::move(fp), SK_PMColor4fWHITE),
|
||||
SkBlendMode::kSrcIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
return GrBlendFragmentProcessor::Make(/*src=*/nullptr,
|
||||
OverrideInput(std::move(fp), SK_PMColor4fWHITE),
|
||||
SkBlendMode::kSrcIn);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ModulateAlpha(
|
||||
std::unique_ptr<GrFragmentProcessor> inputFP, const SkPMColor4f& color) {
|
||||
auto colorFP = MakeColor(color);
|
||||
return GrBlendFragmentProcessor::Make(
|
||||
std::move(colorFP),
|
||||
std::move(inputFP),
|
||||
SkBlendMode::kSrcIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
return GrBlendFragmentProcessor::Make(std::move(colorFP),
|
||||
std::move(inputFP),
|
||||
SkBlendMode::kSrcIn);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ModulateRGBA(
|
||||
std::unique_ptr<GrFragmentProcessor> inputFP, const SkPMColor4f& color) {
|
||||
auto colorFP = MakeColor(color);
|
||||
return GrBlendFragmentProcessor::Make(
|
||||
std::move(colorFP),
|
||||
std::move(inputFP),
|
||||
SkBlendMode::kModulate,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
return GrBlendFragmentProcessor::Make(std::move(colorFP),
|
||||
std::move(inputFP),
|
||||
SkBlendMode::kModulate);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ClampOutput(
|
||||
|
@ -643,11 +643,7 @@ void GrSurfaceDrawContext::drawTexture(const GrClip* clip,
|
||||
if (colorSpaceXform) {
|
||||
fp = GrColorSpaceXformEffect::Make(std::move(fp), std::move(colorSpaceXform));
|
||||
}
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
nullptr,
|
||||
SkBlendMode::kModulate,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp), nullptr, SkBlendMode::kModulate);
|
||||
paint.setColorFragmentProcessor(std::move(fp));
|
||||
if (blendMode != SkBlendMode::kSrcOver) {
|
||||
paint.setXPFactory(SkBlendMode_AsXPFactory(blendMode));
|
||||
|
@ -430,11 +430,9 @@ static inline bool skpaint_to_grpaint_impl(GrRecordingContext* context,
|
||||
|
||||
SkPMColor4f shaderInput = origColor.makeOpaque().premul();
|
||||
paintFP = GrFragmentProcessor::OverrideInput(std::move(paintFP), shaderInput);
|
||||
paintFP = GrBlendFragmentProcessor::Make(
|
||||
std::move(paintFP),
|
||||
/*dst=*/nullptr,
|
||||
*primColorMode,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
paintFP = GrBlendFragmentProcessor::Make(std::move(paintFP),
|
||||
/*dst=*/nullptr,
|
||||
*primColorMode);
|
||||
|
||||
// We can ignore origColor here - alpha is unchanged by gamma
|
||||
float paintAlpha = skPaint.getColor4f().fA;
|
||||
@ -453,11 +451,9 @@ static inline bool skpaint_to_grpaint_impl(GrRecordingContext* context,
|
||||
// the opaque paint color. The paint's alpha is applied to the post-blended color.
|
||||
SkPMColor4f opaqueColor = origColor.makeOpaque().premul();
|
||||
paintFP = GrFragmentProcessor::MakeColor(opaqueColor);
|
||||
paintFP = GrBlendFragmentProcessor::Make(
|
||||
std::move(paintFP),
|
||||
/*dst=*/nullptr,
|
||||
*primColorMode,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
paintFP = GrBlendFragmentProcessor::Make(std::move(paintFP),
|
||||
/*dst=*/nullptr,
|
||||
*primColorMode);
|
||||
grPaint->setColor4f(opaqueColor);
|
||||
|
||||
// We can ignore origColor here - alpha is unchanged by gamma
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
|
||||
using GrBlendFragmentProcessor::BlendBehavior;
|
||||
|
||||
// Some of the cpu implementations of blend modes differ too much from the GPU enough that
|
||||
// we can't use the cpu implementation to implement constantOutputForConstantInput.
|
||||
static inline bool does_cpu_blend_impl_match_gpu(SkBlendMode mode) {
|
||||
@ -25,24 +23,15 @@ static inline bool does_cpu_blend_impl_match_gpu(SkBlendMode mode) {
|
||||
mode != SkBlendMode::kColorBurn;
|
||||
}
|
||||
|
||||
static const char* BlendBehavior_Name(BlendBehavior behavior) {
|
||||
SkASSERT(unsigned(behavior) <= unsigned(BlendBehavior::kLastBlendBehavior));
|
||||
static constexpr const char* gStrings[] = {
|
||||
"Compose-One",
|
||||
};
|
||||
static_assert(SK_ARRAY_COUNT(gStrings) == size_t(BlendBehavior::kLastBlendBehavior) + 1);
|
||||
return gStrings[int(behavior)];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class BlendFragmentProcessor : public GrFragmentProcessor {
|
||||
public:
|
||||
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> src,
|
||||
std::unique_ptr<GrFragmentProcessor> dst,
|
||||
SkBlendMode mode, BlendBehavior behavior) {
|
||||
SkBlendMode mode) {
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new BlendFragmentProcessor(std::move(src), std::move(dst), mode, behavior));
|
||||
new BlendFragmentProcessor(std::move(src), std::move(dst), mode));
|
||||
}
|
||||
|
||||
const char* name() const override { return "Blend"; }
|
||||
@ -50,23 +39,20 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> clone() const override;
|
||||
|
||||
SkBlendMode getMode() const { return fMode; }
|
||||
BlendBehavior blendBehavior() const { return fBlendBehavior; }
|
||||
|
||||
private:
|
||||
BlendFragmentProcessor(std::unique_ptr<GrFragmentProcessor> src,
|
||||
std::unique_ptr<GrFragmentProcessor> dst,
|
||||
SkBlendMode mode, BlendBehavior behavior)
|
||||
std::unique_ptr<GrFragmentProcessor> dst,
|
||||
SkBlendMode mode)
|
||||
: INHERITED(kBlendFragmentProcessor_ClassID, OptFlags(src.get(), dst.get(), mode))
|
||||
, fMode(mode)
|
||||
, fBlendBehavior(behavior) {
|
||||
, fMode(mode) {
|
||||
this->registerChild(std::move(src));
|
||||
this->registerChild(std::move(dst));
|
||||
}
|
||||
|
||||
BlendFragmentProcessor(const BlendFragmentProcessor& that)
|
||||
: INHERITED(kBlendFragmentProcessor_ClassID, ProcessorOptimizationFlags(&that))
|
||||
, fMode(that.fMode)
|
||||
, fBlendBehavior(that.fBlendBehavior) {
|
||||
, fMode(that.fMode) {
|
||||
this->cloneAndRegisterAllChildProcessors(that);
|
||||
}
|
||||
|
||||
@ -169,23 +155,15 @@ private:
|
||||
const auto* src = this->childProcessor(0);
|
||||
const auto* dst = this->childProcessor(1);
|
||||
|
||||
switch (fBlendBehavior) {
|
||||
case BlendBehavior::kComposeOneBehavior: {
|
||||
SkPMColor4f srcColor = ConstantOutputForConstantInput(src, input);
|
||||
SkPMColor4f dstColor = ConstantOutputForConstantInput(dst, input);
|
||||
return SkBlendMode_Apply(fMode, srcColor, dstColor);
|
||||
}
|
||||
SkPMColor4f srcColor = ConstantOutputForConstantInput(src, input);
|
||||
SkPMColor4f dstColor = ConstantOutputForConstantInput(dst, input);
|
||||
|
||||
default:
|
||||
SK_ABORT("unrecognized blend behavior");
|
||||
return input;
|
||||
}
|
||||
return SkBlendMode_Apply(fMode, srcColor, dstColor);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
|
||||
|
||||
SkBlendMode fMode;
|
||||
BlendBehavior fBlendBehavior;
|
||||
|
||||
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
|
||||
|
||||
@ -216,14 +194,11 @@ std::unique_ptr<GrFragmentProcessor> BlendFragmentProcessor::TestCreate(GrProces
|
||||
}
|
||||
|
||||
SkBlendMode mode;
|
||||
BlendBehavior behavior;
|
||||
do {
|
||||
mode = static_cast<SkBlendMode>(d->fRandom->nextRangeU(0, (int)SkBlendMode::kLastMode));
|
||||
behavior = static_cast<BlendBehavior>(
|
||||
d->fRandom->nextRangeU(0, (int)BlendBehavior::kLastBlendBehavior));
|
||||
} while (SkBlendMode::kClear == mode || SkBlendMode::kSrc == mode || SkBlendMode::kDst == mode);
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new BlendFragmentProcessor(std::move(src), std::move(dst), mode, behavior));
|
||||
new BlendFragmentProcessor(std::move(src), std::move(dst), mode));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -241,23 +216,13 @@ void GLBlendFragmentProcessor::emitCode(EmitArgs& args) {
|
||||
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
|
||||
const BlendFragmentProcessor& cs = args.fFp.cast<BlendFragmentProcessor>();
|
||||
SkBlendMode mode = cs.getMode();
|
||||
BlendBehavior behavior = cs.blendBehavior();
|
||||
|
||||
// Load the input color and make an opaque copy if needed.
|
||||
fragBuilder->codeAppendf("// Blend mode: %s (%s behavior)\n",
|
||||
SkBlendMode_Name(mode), BlendBehavior_Name(behavior));
|
||||
fragBuilder->codeAppendf("// Blend mode: %s\n", SkBlendMode_Name(mode));
|
||||
|
||||
SkString srcColor, dstColor;
|
||||
switch (behavior) {
|
||||
case BlendBehavior::kComposeOneBehavior:
|
||||
srcColor = this->invokeChild(0, args.fInputColor, args);
|
||||
dstColor = this->invokeChild(1, args.fInputColor, args);
|
||||
break;
|
||||
|
||||
default:
|
||||
SK_ABORT("unrecognized blend behavior");
|
||||
break;
|
||||
}
|
||||
// Invoke src/dst with our input color (or substitute input color if no child FP)
|
||||
SkString srcColor = this->invokeChild(0, args.fInputColor, args);
|
||||
SkString dstColor = this->invokeChild(1, args.fInputColor, args);
|
||||
|
||||
// Blend src and dst colors together.
|
||||
fragBuilder->codeAppendf("return %s(%s, %s)", GrGLSLBlend::BlendFuncName(mode),
|
||||
@ -271,7 +236,7 @@ void GLBlendFragmentProcessor::emitCode(EmitArgs& args) {
|
||||
std::unique_ptr<GrFragmentProcessor> GrBlendFragmentProcessor::Make(
|
||||
std::unique_ptr<GrFragmentProcessor> src,
|
||||
std::unique_ptr<GrFragmentProcessor> dst,
|
||||
SkBlendMode mode, BlendBehavior behavior) {
|
||||
SkBlendMode mode) {
|
||||
switch (mode) {
|
||||
case SkBlendMode::kClear:
|
||||
return GrFragmentProcessor::MakeColor(SK_PMColor4fTRANSPARENT);
|
||||
@ -280,6 +245,6 @@ std::unique_ptr<GrFragmentProcessor> GrBlendFragmentProcessor::Make(
|
||||
case SkBlendMode::kDst:
|
||||
return dst;
|
||||
default:
|
||||
return BlendFragmentProcessor::Make(std::move(src), std::move(dst), mode, behavior);
|
||||
return BlendFragmentProcessor::Make(std::move(src), std::move(dst), mode);
|
||||
}
|
||||
}
|
||||
|
@ -15,21 +15,13 @@ class GrFragmentProcessor;
|
||||
|
||||
namespace GrBlendFragmentProcessor {
|
||||
|
||||
// TODO(skbug.com/10457): Standardize on a single blend behavior
|
||||
enum class BlendBehavior {
|
||||
// fInputColor is passed as the input color to child FPs. No alpha channel trickery.
|
||||
kComposeOneBehavior,
|
||||
|
||||
kLastBlendBehavior = kComposeOneBehavior,
|
||||
};
|
||||
|
||||
/** Blends src and dst inputs according to the blend mode.
|
||||
* If either input is null, fInputColor is used instead.
|
||||
/**
|
||||
* Blends src and dst inputs according to the blend mode. If either input is null, fInputColor is
|
||||
* used instead.
|
||||
*/
|
||||
std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> src,
|
||||
std::unique_ptr<GrFragmentProcessor> dst,
|
||||
SkBlendMode mode,
|
||||
BlendBehavior behavior);
|
||||
SkBlendMode mode);
|
||||
|
||||
} // namespace GrBlendFragmentProcessor
|
||||
|
||||
|
@ -1167,11 +1167,7 @@ GrOp::Owner GrTextureOp::Make(GrRecordingContext* context,
|
||||
caps);
|
||||
}
|
||||
fp = GrColorSpaceXformEffect::Make(std::move(fp), std::move(textureXform));
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
nullptr,
|
||||
SkBlendMode::kModulate,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp), nullptr, SkBlendMode::kModulate);
|
||||
if (saturate == GrTextureOp::Saturate::kYes) {
|
||||
fp = GrFragmentProcessor::ClampOutput(std::move(fp));
|
||||
}
|
||||
|
@ -510,17 +510,9 @@ void draw_image(GrRecordingContext* context,
|
||||
image.imageInfo().colorInfo(),
|
||||
rtc->colorInfo());
|
||||
if (image.isAlphaOnly()) {
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
nullptr,
|
||||
SkBlendMode::kDstIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp), nullptr, SkBlendMode::kDstIn);
|
||||
} else {
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
nullptr,
|
||||
SkBlendMode::kSrcIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(fp), nullptr, SkBlendMode::kSrcIn);
|
||||
}
|
||||
|
||||
GrPaint grPaint;
|
||||
|
@ -137,11 +137,7 @@ std::unique_ptr<GrFragmentProcessor> SkShader_Blend::asFragmentProcessor(
|
||||
// This is unexpected. Both src and dst shaders should be valid. Just fail.
|
||||
return nullptr;
|
||||
}
|
||||
auto blend = GrBlendFragmentProcessor::Make(
|
||||
std::move(fpB),
|
||||
std::move(fpA),
|
||||
fMode,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
auto blend = GrBlendFragmentProcessor::Make(std::move(fpB), std::move(fpA), fMode);
|
||||
return GrFragmentProcessor::MakeInputOpaqueAndPostApplyAlpha(std::move(blend));
|
||||
}
|
||||
#endif
|
||||
|
@ -340,11 +340,7 @@ std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
|
||||
args.fDstColorInfo->colorSpace(),
|
||||
kPremul_SkAlphaType);
|
||||
if (fImage->isAlphaOnly()) {
|
||||
return GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
nullptr,
|
||||
SkBlendMode::kDstIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
return GrBlendFragmentProcessor::Make(std::move(fp), nullptr, SkBlendMode::kDstIn);
|
||||
} else if (args.fInputColorIsOpaque) {
|
||||
// If the input alpha is known to be 1, we don't need to take the kSrcIn path. This is
|
||||
// just an optimization. However, we can't just return 'fp' here. We need to actually
|
||||
@ -353,11 +349,7 @@ std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
|
||||
// doesn't actually use the input color at all, so the overridden input is irrelevant.
|
||||
return GrFragmentProcessor::OverrideInput(std::move(fp), SK_PMColor4fWHITE, false);
|
||||
}
|
||||
return GrBlendFragmentProcessor::Make(
|
||||
std::move(fp),
|
||||
nullptr,
|
||||
SkBlendMode::kSrcIn,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
return GrBlendFragmentProcessor::Make(std::move(fp), nullptr, SkBlendMode::kSrcIn);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -204,18 +204,10 @@ static std::unique_ptr<GrFragmentProcessor> create_random_proc_tree(GrProcessorT
|
||||
(int)SkBlendMode::kLastMode));
|
||||
std::unique_ptr<GrFragmentProcessor> fp;
|
||||
if (d->fRandom->nextF() < 0.5f) {
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(minLevelsChild),
|
||||
std::move(otherChild),
|
||||
mode,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(minLevelsChild), std::move(otherChild), mode);
|
||||
SkASSERT(fp);
|
||||
} else {
|
||||
fp = GrBlendFragmentProcessor::Make(
|
||||
std::move(otherChild),
|
||||
std::move(minLevelsChild),
|
||||
mode,
|
||||
GrBlendFragmentProcessor::BlendBehavior::kComposeOneBehavior);
|
||||
fp = GrBlendFragmentProcessor::Make(std::move(otherChild), std::move(minLevelsChild), mode);
|
||||
SkASSERT(fp);
|
||||
}
|
||||
return fp;
|
||||
|
Loading…
Reference in New Issue
Block a user