GrXferProcessor* PDLCDXferProcessor::Create(SkXfermode::Mode xfermode, const GrProcOptInfo& colorPOI) { if (SkXfermode::kSrcOver_Mode != xfermode) { return NULL; } if (kRGBA_GrColorComponentFlags != colorPOI.validFlags()) { return NULL; } GrColor blendConstant = GrUnPreMulColor(colorPOI.color()); uint8_t alpha = GrColorUnpackA(blendConstant); blendConstant |= (0xff << GrColor_SHIFT_A); return SkNEW_ARGS(PDLCDXferProcessor, (blendConstant, alpha)); }
GrXferProcessor* GrPorterDuffXPFactory::onCreateXferProcessor(const GrDrawTargetCaps& caps, const GrProcOptInfo& colorPOI, const GrProcOptInfo& covPOI, const GrDeviceCoordTexture* dstCopy) const { if (!covPOI.isFourChannelOutput()) { return PorterDuffXferProcessor::Create(fSrcCoeff, fDstCoeff, 0, dstCopy, this->willReadDstColor(caps, colorPOI, covPOI)); } else { if (this->supportsRGBCoverage(colorPOI.color(), colorPOI.validFlags())) { SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); GrColor blendConstant = GrUnPreMulColor(colorPOI.color()); return PorterDuffXferProcessor::Create(kConstC_GrBlendCoeff, kISC_GrBlendCoeff, blendConstant, dstCopy, this->willReadDstColor(caps, colorPOI, covPOI)); } else { return NULL; } } }