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

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

Issue 885923002: Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Back to bool Created 5 years, 10 months 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/GrGLGpu.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 5038aa333fa21b67e36bd865d72d85f787444bcb..320d943392898fcb4f1a6d4490841fe44567282c 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -38,7 +38,15 @@ public:
virtual ~GrGLPorterDuffXferProcessor() {}
- void emitCode(const EmitArgs& args) SK_OVERRIDE {
+ static void GenKey(const GrProcessor& processor, const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) {
+ const GrPorterDuffXferProcessor& xp = processor.cast<GrPorterDuffXferProcessor>();
+ b->add32(xp.primaryOutputType());
+ b->add32(xp.secondaryOutputType());
+ };
+
+private:
+ void onEmitCode(const EmitArgs& args) SK_OVERRIDE {
const GrPorterDuffXferProcessor& xp = args.fXP.cast<GrPorterDuffXferProcessor>();
GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
if (xp.hasSecondaryOutput()) {
@@ -80,23 +88,18 @@ public:
}
}
- void setData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVERRIDE {};
+ void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVERRIDE {};
- static void GenKey(const GrProcessor& processor, const GrGLCaps& caps,
- GrProcessorKeyBuilder* b) {
- const GrPorterDuffXferProcessor& xp = processor.cast<GrPorterDuffXferProcessor>();
- b->add32(xp.primaryOutputType());
- b->add32(xp.secondaryOutputType());
- };
-
-private:
typedef GrGLXferProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
-GrPorterDuffXferProcessor::GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend,
- GrColor constant)
+GrPorterDuffXferProcessor::GrPorterDuffXferProcessor(GrBlendCoeff srcBlend,
+ GrBlendCoeff dstBlend,
+ GrColor constant,
+ const GrDeviceCoordTexture* dstCopy,
+ bool willReadDstColor)
: fSrcBlend(srcBlend)
, fDstBlend(dstBlend)
, fBlendConstant(constant)
@@ -108,8 +111,8 @@ GrPorterDuffXferProcessor::GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBl
GrPorterDuffXferProcessor::~GrPorterDuffXferProcessor() {
}
-void GrPorterDuffXferProcessor::getGLProcessorKey(const GrGLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+void GrPorterDuffXferProcessor::onGetGLProcessorKey(const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const {
GrGLPorterDuffXferProcessor::GenKey(*this, caps, b);
}
@@ -353,16 +356,20 @@ GrXPFactory* GrPorterDuffXPFactory::Create(SkXfermode::Mode mode) {
}
}
-GrXferProcessor* GrPorterDuffXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& covPOI) const {
+GrXferProcessor*
+GrPorterDuffXPFactory::onCreateXferProcessor(const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& covPOI,
+ const GrDeviceCoordTexture* dstCopy) const {
if (!covPOI.isFourChannelOutput()) {
- return GrPorterDuffXferProcessor::Create(fSrcCoeff, fDstCoeff);
+ return GrPorterDuffXferProcessor::Create(fSrcCoeff, fDstCoeff, 0, dstCopy,
+ this->willReadDstColor());
} else {
if (this->supportsRGBCoverage(colorPOI.color(), colorPOI.validFlags())) {
SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags());
GrColor blendConstant = GrUnPreMulColor(colorPOI.color());
return GrPorterDuffXferProcessor::Create(kConstC_GrBlendCoeff, kISC_GrBlendCoeff,
- blendConstant);
+ blendConstant, dstCopy,
+ this->willReadDstColor());
} else {
return NULL;
}
@@ -484,6 +491,10 @@ void GrPorterDuffXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
output->fWillBlendWithDst = false;
}
+bool GrPorterDuffXPFactory::willReadDstColor() const {
+ return false;
+}
+
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/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698