Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: src/gpu/GrPaint.cpp

Issue 814933002: Add an InvariantOutput for the XPF. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrPaint.cpp
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index 5ed573a88bbb0906a4dd8d4ea210368f672d6b39..19977963309b94fa8c666a8b7c1b550882ef147b 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -32,18 +32,21 @@ void GrPaint::addCoverageTextureProcessor(GrTexture* texture,
this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix, params))->unref();
}
-bool GrPaint::isOpaque() const {
- return this->getOpaqueAndKnownColor(NULL, NULL);
-}
-
bool GrPaint::isOpaqueAndConstantColor(GrColor* color) const {
- GrColor tempColor = 0;
- uint32_t colorComps = 0;
- if (this->getOpaqueAndKnownColor(&tempColor, &colorComps)) {
- if (kRGBA_GrColorComponentFlags == colorComps) {
- *color = tempColor;
- return true;
- }
+ GrProcOptInfo coverageProcInfo;
+ coverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->numCoverageStages(),
+ 0xFFFFFFFF, kRGBA_GrColorComponentFlags, true);
+ GrProcOptInfo colorProcInfo;
+ colorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColorStages(), fColor,
+ kRGBA_GrColorComponentFlags, false);
+
+ GrXPFactory::InvariantOutput output;
+ fXPFactory->getInvariantOutput(colorProcInfo, coverageProcInfo, true, &output);
+
+ if (kRGBA_GrColorComponentFlags == output.fBlendedColorFlags &&
+ 0xFF == GrColorUnpackA(output.fBlendedColor)) {
+ *color = output.fBlendedColor;
+ return true;
}
return false;
}
@@ -54,17 +57,3 @@ void GrPaint::resetStages() {
fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode));
}
-bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor,
- uint32_t* solidColorKnownComponents) const {
-
- GrProcOptInfo coverageProcInfo;
- coverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->numCoverageStages(),
- 0xFFFFFFFF, kRGBA_GrColorComponentFlags, true);
- GrProcOptInfo colorProcInfo;
- colorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColorStages(), fColor,
- kRGBA_GrColorComponentFlags, false);
-
- return fXPFactory->getOpaqueAndKnownColor(colorProcInfo, coverageProcInfo, solidColor,
- solidColorKnownComponents);
-}
-

Powered by Google App Engine
This is Rietveld 408576698