当前位置: 首页>>代码示例>>C++>>正文


C++ BlendFormula类代码示例

本文整理汇总了C++中BlendFormula的典型用法代码示例。如果您正苦于以下问题:C++ BlendFormula类的具体用法?C++ BlendFormula怎么用?C++ BlendFormula使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BlendFormula类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
    }
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:30,代码来源:GrPorterDuffXferProcessor.cpp

示例2: ShaderPDXferProcessor

GrXferProcessor*
GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
                                             const GrPipelineOptimizations& optimizations,
                                             bool hasMixedSamples,
                                             const DstTexture* dstTexture) const {
    if (optimizations.fOverrides.fUsePLSDstRead) {
        return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, fXfermode);
    }
    BlendFormula blendFormula;
    if (optimizations.fCoveragePOI.isFourChannelOutput()) {
        if (SkBlendMode::kSrcOver == fXfermode &&
            kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
            !caps.shaderCaps()->dualSourceBlendingSupport() &&
            !caps.shaderCaps()->dstReadInShaderSupport()) {
            // If we don't have dual source blending or in shader dst reads, we fall back to this
            // trick for rendering SrcOver LCD text instead of doing a dst copy.
            SkASSERT(!dstTexture || !dstTexture->texture());
            return PDLCDXferProcessor::Create(fXfermode, optimizations.fColorPOI);
        }
        blendFormula = get_lcd_blend_formula(optimizations.fCoveragePOI, fXfermode);
    } else {
        blendFormula = get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI,
                                         hasMixedSamples, fXfermode);
    }

    if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
        return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, fXfermode);
    }

    SkASSERT(!dstTexture || !dstTexture->texture());
    return new PorterDuffXferProcessor(blendFormula);
}
开发者ID:aseprite,项目名称:skia,代码行数:32,代码来源:GrPorterDuffXferProcessor.cpp

示例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;
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:27,代码来源:GrPorterDuffXferProcessor.cpp

示例4: Create

GrXferProcessor*
GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
                                             const GrProcOptInfo& colorPOI,
                                             const GrProcOptInfo& covPOI,
                                             bool hasMixedSamples,
                                             const DstTexture* dstTexture) const {
    BlendFormula blendFormula;
    if (covPOI.isFourChannelOutput()) {
        if (SkXfermode::kSrcOver_Mode == fXfermode &&
            kRGBA_GrColorComponentFlags == colorPOI.validFlags()) {
            SkASSERT(!dstTexture || !dstTexture->texture());
            return PDLCDXferProcessor::Create(fXfermode, colorPOI);
        }
        blendFormula = get_lcd_blend_formula(covPOI, fXfermode);
    } else {
        blendFormula = get_blend_formula(colorPOI, covPOI, hasMixedSamples, fXfermode);
    }

    if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
        return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, fXfermode);
    }

    SkASSERT(!dstTexture || !dstTexture->texture());
    return new PorterDuffXferProcessor(blendFormula);
}
开发者ID:wzugang,项目名称:skia,代码行数:25,代码来源:GrPorterDuffXferProcessor.cpp

示例5: emitOutputsForBlendState

    void emitOutputsForBlendState(const EmitArgs& args) override {
        const PorterDuffXferProcessor& xp = args.fXP.cast<PorterDuffXferProcessor>();
        GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();

        BlendFormula blendFormula = xp.getBlendFormula();
        if (blendFormula.hasSecondaryOutput()) {
            append_color_output(xp, fsBuilder, blendFormula.fSecondaryOutputType,
                                args.fOutputSecondary, args.fInputColor, args.fInputCoverage);
        }
        append_color_output(xp, fsBuilder, blendFormula.fPrimaryOutputType,
                            args.fOutputPrimary, args.fInputColor, args.fInputCoverage);
    }
开发者ID:mariospr,项目名称:chromium-browser,代码行数:12,代码来源:GrPorterDuffXferProcessor.cpp

示例6: SkASSERT

GrXferProcessor*
GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
                                             const GrProcOptInfo& colorPOI,
                                             const GrProcOptInfo& covPOI,
                                             const DstTexture* dstTexture) const {
    if (covPOI.isFourChannelOutput()) {
        SkASSERT(!dstTexture || !dstTexture->texture());
        return PDLCDXferProcessor::Create(fXfermode, colorPOI);
    }

    BlendFormula blendFormula = get_blend_formula(fXfermode, colorPOI, covPOI);
    if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
        return ShaderPDXferProcessor::Create(fXfermode, dstTexture);
    }

    SkASSERT(!dstTexture || !dstTexture->texture());
    return PorterDuffXferProcessor::Create(blendFormula);
}
开发者ID:Arternis,项目名称:skia,代码行数:18,代码来源:GrPorterDuffXferProcessor.cpp

示例7: SkDEBUGCODE

 bool operator==(const BlendFormula& other) const {
     SkDEBUGCODE(this->validatePreoptimized());
     SkDEBUGCODE(other.validatePreoptimized());
     return fData == other.fData;
 }
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:5,代码来源:GrPorterDuffXferProcessor.cpp


注:本文中的BlendFormula类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。