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

Unified Diff: src/gpu/GrDrawState.cpp

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Review changes 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/GrDrawState.cpp
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 7538cdb34004dca67f8e7f40ce47a90e54969650..1155924af3b82a6d68313fa113ec4a18432e1c44 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -11,8 +11,10 @@
#include "GrOptDrawState.h"
#include "GrPaint.h"
#include "GrProcOptInfo.h"
+#include "GrXferProcessor.h"
+#include "effects/GrPorterDuffXferProcessor.h"
-//////////////////////////////////////////////////////////////////////////////s
+///////////////////////////////////////////////////////////////////////////////
bool GrDrawState::isEqual(const GrDrawState& that) const {
bool usingVertexColors = this->hasColorVertexAttribute();
@@ -102,6 +104,7 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
fCoverage = that.fCoverage;
fDrawFace = that.fDrawFace;
fGeometryProcessor.reset(SkSafeRef(that.fGeometryProcessor.get()));
+ fXPFactory.reset(SkRef(that.getXPFactory()));
fColorStages = that.fColorStages;
fCoverageStages = that.fCoverageStages;
@@ -127,6 +130,8 @@ void GrDrawState::onReset(const SkMatrix* initialViewMatrix) {
fRenderTarget.reset(NULL);
fGeometryProcessor.reset(NULL);
+ fXPFactory.reset(GrPorterDuffXPFactory::Create(kOne_GrBlendCoeff,
+ kZero_GrBlendCoeff));
fColorStages.reset();
fCoverageStages.reset();
@@ -186,6 +191,9 @@ void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
fCoverageStages.push_back(paint.getCoverageStage(i));
}
+ fXPFactory.reset(SkRef(paint.getXPFactory()));
+
+ this->setBlendFunc(paint.getSrcBlendCoeff(), paint.getDstBlendCoeff());
this->setRenderTarget(rt);
fViewMatrix = vm;
@@ -204,7 +212,6 @@ void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
this->setState(GrDrawState::kDither_StateBit, paint.isDither());
this->setState(GrDrawState::kHWAntialias_StateBit, paint.isAntiAlias());
- this->setBlendFunc(paint.getSrcBlendCoeff(), paint.getDstBlendCoeff());
this->setCoverage(0xFF);
fColorProcInfoValid = false;
fCoverageProcInfoValid = false;
@@ -660,6 +667,11 @@ bool GrDrawState::willBlendWithDst() const {
return false;
}
+bool GrDrawState::coverageWillBeSingleComponent() const {
bsalomon 2014/12/02 15:36:32 Is this called anywhere?
egdaniel 2014/12/02 18:09:51 Nope. Was used in the next CL when DS was passed i
+ this->calcCoverageInvariantOutput();
+ return (fColorProcInfo.isSingleComponent());
+}
+
void GrDrawState::calcColorInvariantOutput() const {
if (!fColorProcInfoValid) {
GrColor color;
« src/core/SkXfermode.cpp ('K') | « src/gpu/GrDrawState.h ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698