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

Unified Diff: src/effects/SkArithmeticMode_gpu.cpp

Issue 901663007: Revert of Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/effects/SkArithmeticMode_gpu.h ('k') | src/gpu/GrBatchTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkArithmeticMode_gpu.cpp
diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp
index 6379b8dc822fba2f3bdf1c7bac49baef068b1469..38bb904538509216ec1eafe6aac881684533fd80 100644
--- a/src/effects/SkArithmeticMode_gpu.cpp
+++ b/src/effects/SkArithmeticMode_gpu.cpp
@@ -166,6 +166,31 @@
~GLArithmeticXP() SK_OVERRIDE {}
+ void emitCode(const EmitArgs& args) SK_OVERRIDE {
+ GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+
+ const char* dstColor = fsBuilder->dstColor();
+
+ fKUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ kVec4f_GrSLType, kDefault_GrSLPrecision,
+ "k");
+ const char* kUni = args.fPB->getUniformCStr(fKUni);
+
+ add_arithmetic_code(fsBuilder, args.fInputColor, dstColor, args.fOutputPrimary, kUni,
+ fEnforcePMColor);
+
+ fsBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;",
+ args.fOutputPrimary, args.fOutputPrimary, args.fInputCoverage,
+ args.fInputCoverage, dstColor);
+ }
+
+ void setData(const GrGLProgramDataManager& pdman,
+ const GrXferProcessor& processor) SK_OVERRIDE {
+ const GrArithmeticXP& arith = processor.cast<GrArithmeticXP>();
+ pdman.set4f(fKUni, arith.k1(), arith.k2(), arith.k3(), arith.k4());
+ fEnforcePMColor = arith.enforcePMColor();
+ };
+
static void GenKey(const GrProcessor& processor, const GrGLCaps& caps,
GrProcessorKeyBuilder* b) {
const GrArithmeticXP& arith = processor.cast<GrArithmeticXP>();
@@ -174,31 +199,6 @@
}
private:
- void onEmitCode(const EmitArgs& args) SK_OVERRIDE {
- GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
-
- const char* dstColor = fsBuilder->dstColor();
-
- fKUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec4f_GrSLType, kDefault_GrSLPrecision,
- "k");
- const char* kUni = args.fPB->getUniformCStr(fKUni);
-
- add_arithmetic_code(fsBuilder, args.fInputColor, dstColor, args.fOutputPrimary, kUni,
- fEnforcePMColor);
-
- fsBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;",
- args.fOutputPrimary, args.fOutputPrimary, args.fInputCoverage,
- args.fInputCoverage, dstColor);
- }
-
- void onSetData(const GrGLProgramDataManager& pdman,
- const GrXferProcessor& processor) SK_OVERRIDE {
- const GrArithmeticXP& arith = processor.cast<GrArithmeticXP>();
- pdman.set4f(fKUni, arith.k1(), arith.k2(), arith.k3(), arith.k4());
- fEnforcePMColor = arith.enforcePMColor();
- };
-
GrGLProgramDataManager::UniformHandle fKUni;
bool fEnforcePMColor;
@@ -207,18 +207,17 @@
///////////////////////////////////////////////////////////////////////////////
-GrArithmeticXP::GrArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor,
- const GrDeviceCoordTexture* dstCopy, bool willReadDstColor)
- : INHERITED(dstCopy, willReadDstColor)
- , fK1(k1)
+GrArithmeticXP::GrArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor)
+ : fK1(k1)
, fK2(k2)
, fK3(k3)
, fK4(k4)
, fEnforcePMColor(enforcePMColor) {
this->initClassID<GrArithmeticXP>();
-}
-
-void GrArithmeticXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
+ this->setWillReadDstColor();
+}
+
+void GrArithmeticXP::getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
GLArithmeticXP::GenKey(*this, caps, b);
}
« no previous file with comments | « src/effects/SkArithmeticMode_gpu.h ('k') | src/gpu/GrBatchTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698