bool GrDrawTarget::srcAlphaWillBeOne(GrVertexLayout layout) const { const GrDrawState& drawState = this->getDrawState(); // Check if per-vertex or constant color may have partial alpha if ((layout & kColor_VertexLayoutBit) || 0xff != GrColorUnpackA(drawState.getColor())) { return false; } // Check if color filter could introduce an alpha // (TODO: Consider being more aggressive with regards to detecting 0xff // final alpha from color filter). if (SkXfermode::kDst_Mode != drawState.getColorFilterMode()) { return false; } // Check if a color stage could create a partial alpha for (int s = 0; s < drawState.getFirstCoverageStage(); ++s) { if (StageWillBeUsed(s, layout, this->getDrawState())) { GrAssert(NULL != drawState.getTexture(s)); GrPixelConfig config = drawState.getTexture(s)->config(); if (!GrPixelConfigIsOpaque(config)) { return false; } } } return true; }
bool GrDrawTarget::srcAlphaWillBeOne() const { const GrVertexLayout& layout = this->getGeomSrc().fVertexLayout; // Check if per-vertex or constant color may have partial alpha if ((layout & kColor_VertexLayoutBit) || 0xff != GrColorUnpackA(fCurrDrawState.fColor)) { return false; } // Check if color filter could introduce an alpha // (TODO: Consider being more aggressive with regards to detecting 0xff // final alpha from color filter). if (SkXfermode::kDst_Mode != fCurrDrawState.fColorFilterXfermode) { return false; } // Check if a color stage could create a partial alpha for (int s = 0; s < fCurrDrawState.fFirstCoverageStage; ++s) { if (StageWillBeUsed(s, layout, fCurrDrawState)) { GrAssert(NULL != fCurrDrawState.fTextures[s]); GrPixelConfig config = fCurrDrawState.fTextures[s]->config(); if (!GrPixelConfigIsOpaque(config)) { return false; } } } return true; }
void GrAlphaThresholdFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const { if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { inout->mulByUnknownSingleComponent(); } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >= 1.f) { inout->mulByUnknownOpaqueFourComponents(); } else { inout->mulByUnknownFourComponents(); } }
void GrBitmapTextGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const { if (kARGB_GrMaskFormat != fMaskFormat) { if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { out->setUnknownSingleComponent(); } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) { out->setUnknownOpaqueFourComponents(); out->setUsingLCDCoverage(); } else { out->setUnknownFourComponents(); out->setUsingLCDCoverage(); } } else { out->setKnownSingleComponent(0xff); } }
bool isOpaque() const override { return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_SkAlphaType; }
bool SkImage_Gpu::isOpaque() const { return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_SkAlphaType; }