本文整理汇总了C++中GrProcOptInfo类的典型用法代码示例。如果您正苦于以下问题:C++ GrProcOptInfo类的具体用法?C++ GrProcOptInfo怎么用?C++ GrProcOptInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GrProcOptInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: willReadDstColor
bool GrPorterDuffXPFactory::willReadDstColor(const GrDrawTargetCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const {
// We can always blend correctly if we have dual source blending.
if (caps.shaderCaps()->dualSourceBlendingSupport()) {
return false;
}
if (can_tweak_alpha_for_coverage(fDstCoeff)) {
return false;
}
bool srcAIsOne = colorPOI.isOpaque();
if (kZero_GrBlendCoeff == fDstCoeff) {
if (kZero_GrBlendCoeff == fSrcCoeff || srcAIsOne) {
return false;
}
}
// Reduces to: coeffS * (Cov*S) + D
if (kSA_GrBlendCoeff == fDstCoeff && srcAIsOne) {
return false;
}
// We can always blend correctly if we have solid coverage.
if (coveragePOI.isSolidWhite()) {
return false;
}
return true;
}
示例2: getInvariantBlendedColor
void GrPorterDuffXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
InvariantBlendedColor* blendedColor) const {
// Find the blended color info based on the formula that does not have coverage.
BlendFormula colorFormula = gBlendTable[colorPOI.isOpaque()][0][fXfermode];
if (colorFormula.usesDstColor()) {
blendedColor->fWillBlendWithDst = true;
blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
return;
}
blendedColor->fWillBlendWithDst = false;
SkASSERT(kAdd_GrBlendEquation == colorFormula.fBlendEquation);
switch (colorFormula.fSrcCoeff) {
case kZero_GrBlendCoeff:
blendedColor->fKnownColor = 0;
blendedColor->fKnownColorFlags = kRGBA_GrColorComponentFlags;
return;
case kOne_GrBlendCoeff:
blendedColor->fKnownColor = colorPOI.color();
blendedColor->fKnownColorFlags = colorPOI.validFlags();
return;
default:
blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
return;
}
}
示例3:
GrXferProcessor::OptFlags
PorterDuffXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) {
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
if (!fBlendFormula.modifiesDst()) {
if (!doesStencilWrite) {
optFlags |= GrXferProcessor::kSkipDraw_OptFlag;
}
optFlags |= (GrXferProcessor::kIgnoreColor_OptFlag |
GrXferProcessor::kIgnoreCoverage_OptFlag |
GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag);
} else {
if (!fBlendFormula.usesInputColor()) {
optFlags |= GrXferProcessor::kIgnoreColor_OptFlag;
}
if (coveragePOI.isSolidWhite()) {
optFlags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
}
if (colorPOI.allStagesMultiplyInput() && fBlendFormula.canTweakAlphaForCoverage()) {
optFlags |= GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag;
}
}
return optFlags;
}
示例4: adjustProgramFromOptimizations
void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelineBuilder,
GrXferProcessor::OptFlags flags,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
int* firstColorStageIdx,
int* firstCoverageStageIdx) {
fReadsFragPosition = fXferProcessor->willReadFragmentPosition();
if ((flags & GrXferProcessor::kIgnoreColor_OptFlag) ||
(flags & GrXferProcessor::kOverrideColor_OptFlag)) {
*firstColorStageIdx = pipelineBuilder.numColorFragmentStages();
} else {
if (coveragePOI.readsFragPosition()) {
fReadsFragPosition = true;
}
}
if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
*firstCoverageStageIdx = pipelineBuilder.numCoverageFragmentStages();
} else {
if (coveragePOI.readsFragPosition()) {
fReadsFragPosition = true;
}
}
}
示例5: get_blend_formula
static BlendFormula get_blend_formula(SkXfermode::Mode xfermode,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) {
SkASSERT(xfermode >= 0 && xfermode <= SkXfermode::kLastCoeffMode);
SkASSERT(!coveragePOI.isFourChannelOutput());
return gBlendTable[colorPOI.isOpaque()][!coveragePOI.isSolidWhite()][xfermode];
}
示例6: get_blend_formula
static BlendFormula get_blend_formula(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
bool hasMixedSamples,
SkXfermode::Mode xfermode) {
SkASSERT(xfermode >= 0 && xfermode <= SkXfermode::kLastCoeffMode);
SkASSERT(!coveragePOI.isFourChannelOutput());
bool conflatesCoverage = !coveragePOI.isSolidWhite() || hasMixedSamples;
return gBlendTable[colorPOI.isOpaque()][conflatesCoverage][xfermode];
}
示例7: isConstantBlendedColor
bool GrPaint::isConstantBlendedColor(GrColor* color) const {
GrProcOptInfo colorProcInfo;
colorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColorStages(), fColor,
kRGBA_GrColorComponentFlags, false);
GrXPFactory::InvariantBlendedColor blendedColor;
fXPFactory->getInvariantBlendedColor(colorProcInfo, &blendedColor);
if (kRGBA_GrColorComponentFlags == blendedColor.fKnownColorFlags) {
*color = blendedColor.fKnownColor;
return true;
}
return false;
}
示例8: get_lcd_blend_formula
static BlendFormula get_lcd_blend_formula(const GrProcOptInfo& coveragePOI,
SkBlendMode xfermode) {
SkASSERT((unsigned)xfermode <= (unsigned)SkBlendMode::kLastCoeffMode);
SkASSERT(coveragePOI.isFourChannelOutput());
return gLCDBlendTable[(int)xfermode];
}
示例9: willReadDstColor
bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const {
if (coveragePOI.isFourChannelOutput()) {
return false; // The LCD XP never does a dst read.
}
// We fallback on the shader XP when the blend formula would use dual source blending but we
// don't have support for it.
return !caps.shaderCaps()->dualSourceBlendingSupport() &&
get_blend_formula(fXfermode, colorPOI, coveragePOI).hasSecondaryOutput();
}
示例10: willReadDstColor
bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& covPOI,
bool hasMixedSamples) const {
if (caps.shaderCaps()->dualSourceBlendingSupport()) {
return false;
}
// When we have four channel coverage we always need to read the dst in order to correctly
// blend. The one exception is when we are using srcover mode and we know the input color into
// the XP.
if (covPOI.isFourChannelOutput()) {
if (SkXfermode::kSrcOver_Mode == fXfermode &&
kRGBA_GrColorComponentFlags == colorPOI.validFlags()) {
return false;
}
return get_lcd_blend_formula(covPOI, fXfermode).hasSecondaryOutput();
}
// We fallback on the shader XP when the blend formula would use dual source blending but we
// don't have support for it.
return get_blend_formula(colorPOI, covPOI, hasMixedSamples, fXfermode).hasSecondaryOutput();
}
示例11: isConstantBlendedColor
bool GrPaint::isConstantBlendedColor(GrColor* color) const {
GrProcOptInfo colorProcInfo;
colorProcInfo.calcWithInitialValues(fColorFragmentProcessors.begin(),
this->numColorFragmentProcessors(), fColor,
kRGBA_GrColorComponentFlags, false);
GrXPFactory::InvariantBlendedColor blendedColor;
if (fXPFactory) {
fXPFactory->getInvariantBlendedColor(colorProcInfo, &blendedColor);
} else {
GrPorterDuffXPFactory::SrcOverInvariantBlendedColor(colorProcInfo.color(),
colorProcInfo.validFlags(),
colorProcInfo.isOpaque(),
&blendedColor);
}
if (kRGBA_GrColorComponentFlags == blendedColor.fKnownColorFlags) {
*color = blendedColor.fKnownColor;
return true;
}
return false;
}
示例12: willReadDstColor
bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& covPOI,
bool hasMixedSamples) const {
if (caps.shaderCaps()->dualSourceBlendingSupport()) {
return false;
}
if (covPOI.isFourChannelOutput()) {
return false; // The LCD XP will abort rather than doing a dst read.
}
// We fallback on the shader XP when the blend formula would use dual source blending but we
// don't have support for it.
return get_blend_formula(colorPOI, covPOI, hasMixedSamples, fXfermode).hasSecondaryOutput();
}
示例13: GrColorUnpackA
GrXferProcessor::OptFlags
PorterDuffXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
const GrDrawTargetCaps& caps) {
GrXferProcessor::OptFlags optFlags;
// Optimizations when doing RGB Coverage
if (coveragePOI.isFourChannelOutput()) {
// We want to force our primary output to be alpha * Coverage, where alpha is the alpha
// value of the blend the constant. We should already have valid blend coeff's if we are at
// a point where we have RGB coverage. We don't need any color stages since the known color
// output is already baked into the blendConstant.
uint8_t alpha = GrColorUnpackA(fBlendConstant);
*overrideColor = GrColorPackRGBA(alpha, alpha, alpha, alpha);
optFlags = GrXferProcessor::kOverrideColor_OptFlag;
} else {
optFlags = this->internalGetOptimizations(colorPOI,
coveragePOI,
doesStencilWrite);
}
this->calcOutputTypes(optFlags, caps, coveragePOI.isSolidWhite());
return optFlags;
}
示例14: getInvariantOutput
void GrCoverageSetOpXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
GrXPFactory::InvariantOutput* output) const {
if (SkRegion::kReplace_Op == fRegionOp) {
if (coveragePOI.isSolidWhite()) {
output->fBlendedColor = GrColor_WHITE;
output->fBlendedColorFlags = kRGBA_GrColorComponentFlags;
} else {
output->fBlendedColorFlags = 0;
}
output->fWillBlendWithDst = false;
} else {
output->fBlendedColorFlags = 0;
output->fWillBlendWithDst = true;
}
}
示例15: getOptimizations
GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) {
GrXferProcessor::OptFlags flags = this->onGetOptimizations(colorPOI,
coveragePOI,
doesStencilWrite,
overrideColor,
caps);
if (this->willReadDstColor()) {
// When performing a dst read we handle coverage in the base class.
SkASSERT(!(flags & GrXferProcessor::kIgnoreCoverage_OptFlag));
if (coveragePOI.isSolidWhite()) {
flags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
}
}
if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
fReadsCoverage = false;
}
return flags;
}