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

Unified Diff: src/gpu/effects/GrPorterDuffXferProcessor.cpp

Issue 787233003: Add XP to handle the cases where we disable color write. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update 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
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.cpp ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrPorterDuffXferProcessor.cpp
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 2dd3d539a6061785c624ea340a2169cae98de0ec..2b10cadbf18420ce4057b3e31cfe40a174617f5e 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -9,7 +9,6 @@
#include "GrBlend.h"
#include "GrDrawTargetCaps.h"
-#include "GrInvariantOutput.h"
#include "GrProcessor.h"
#include "GrProcOptInfo.h"
#include "GrTypes.h"
@@ -127,7 +126,6 @@ GrGLXferProcessor* GrPorterDuffXferProcessor::createGLInstance() const {
GrXferProcessor::OptFlags
GrPorterDuffXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
- bool colorWriteDisabled,
bool doesStencilWrite,
GrColor* overrideColor,
const GrDrawTargetCaps& caps) {
@@ -144,7 +142,6 @@ GrPorterDuffXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
} else {
optFlags = this->internalGetOptimizations(colorPOI,
coveragePOI,
- colorWriteDisabled,
doesStencilWrite);
}
this->calcOutputTypes(optFlags, caps, coveragePOI.isSolidWhite(),
@@ -198,13 +195,7 @@ void GrPorterDuffXferProcessor::calcOutputTypes(GrXferProcessor::OptFlags optFla
GrXferProcessor::OptFlags
GrPorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
- bool colorWriteDisabled,
bool doesStencilWrite) {
- if (colorWriteDisabled) {
- fSrcBlend = kZero_GrBlendCoeff;
- fDstBlend = kOne_GrBlendCoeff;
- }
-
bool srcAIsOne;
bool hasCoverage;
@@ -399,14 +390,9 @@ bool GrPorterDuffXPFactory::supportsRGBCoverage(GrColor /*knownColor*/,
}
bool GrPorterDuffXPFactory::canApplyCoverage(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- bool colorWriteDisabled) const {
+ const GrProcOptInfo& coveragePOI) const {
bool srcAIsOne = colorPOI.isOpaque();
- if (colorWriteDisabled) {
- return true;
- }
-
bool dstCoeffIsOne = kOne_GrBlendCoeff == fDstCoeff ||
(kSA_GrBlendCoeff == fDstCoeff && srcAIsOne);
bool dstCoeffIsZero = kZero_GrBlendCoeff == fDstCoeff ||
@@ -449,7 +435,6 @@ bool GrPorterDuffXPFactory::canTweakAlphaForCoverage() const {
void GrPorterDuffXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
- bool colorWriteDisabled,
GrXPFactory::InvariantOutput* output) const {
if (!coveragePOI.isSolidWhite()) {
output->fWillBlendWithDst = true;
@@ -516,13 +501,18 @@ void GrPorterDuffXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
// TODO: once all SkXferEffects are XP's then we will never reads dst here since only XP's
// will readDst and PD XP's don't read dst.
- if ((!colorWriteDisabled && colorPOI.readsDst()) || coveragePOI.readsDst()) {
+ if (colorPOI.readsDst() || coveragePOI.readsDst()) {
output->fWillBlendWithDst = true;
return;
}
output->fWillBlendWithDst = false;
}
+bool GrPorterDuffXPFactory::willReadDst(const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI) const {
+ return colorPOI.readsDst() || coveragePOI.readsDst();
+}
+
GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random,
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.cpp ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698