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

Unified Diff: src/gpu/GrDrawState.cpp

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: update devrect Created 5 years, 11 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
Index: src/gpu/GrDrawState.cpp
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 4ec39e7005a327d5470fafebfd40c61efa209f6d..f3a1b45cd942110d2367bc65ca58061b3793dafe 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -59,6 +59,8 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
fCoverageCache = that.fCoverageCache;
fColorPrimProc = that.fColorPrimProc;
fCoveragePrimProc = that.fCoveragePrimProc;
+ fColorBatch = that.fColorBatch;
+ fCoverageBatch = that.fCoverageBatch;
if (fColorProcInfoValid) {
fColorProcInfo = that.fColorProcInfo;
}
@@ -88,6 +90,9 @@ void GrDrawState::onReset() {
fColorPrimProc = NULL;
fCoveragePrimProc = NULL;
+
+ fColorBatch = NULL;
+ fCoverageBatch = NULL;
}
void GrDrawState::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) {
@@ -127,6 +132,9 @@ void GrDrawState::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) {
fColorPrimProc = NULL;
fCoveragePrimProc = NULL;
+
+ fColorBatch = NULL;
+ fCoverageBatch = NULL;
}
////////////////////////////////////////////////////////////////////////////////
@@ -216,6 +224,29 @@ void GrDrawState::calcCoverageInvariantOutput(const GrPrimitiveProcessor* pp) co
}
}
+void GrDrawState::calcColorInvariantOutput(const GrBatch* batch) const {
+ if (!fColorProcInfoValid || fColorBatch != batch) {
+ GrBatchOpt batchOpt;
+ batchOpt.fCanTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
+ fColorProcInfo.calcColorWithBatch(batch, batchOpt, fColorStages.begin(),
+ this->numColorStages());
+ fColorProcInfoValid = true;
+ fColorBatch = batch;
+ }
+}
+
+void GrDrawState::calcCoverageInvariantOutput(const GrBatch* batch) const {
+ if (!fCoverageProcInfoValid || fCoverageBatch != batch) {
+ GrBatchOpt batchOpt;
+ batchOpt.fCanTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
+ fCoverageProcInfo.calcCoverageWithBatch(batch, batchOpt, fCoverageStages.begin(),
+ this->numCoverageStages());
+ fCoverageProcInfoValid = true;
+ fCoverageBatch = batch;
+ }
+}
+
+
void GrDrawState::calcColorInvariantOutput(GrColor color) const {
if (!fColorProcInfoValid || color != fColorCache) {
GrColorComponentFlags flags = kRGBA_GrColorComponentFlags;

Powered by Google App Engine
This is Rietveld 408576698