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

Unified Diff: include/gpu/GrXferProcessor.h

Issue 1049143002: Add onGetBlendInfo to GrXferProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_nvbea_tokens
Patch Set: rebase Created 5 years, 8 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 | « no previous file | src/effects/SkArithmeticMode_gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrXferProcessor.h
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 87663b1a1f92093fd098ab8898d0730fa5319e2a..5ad5d3f0fc78b02307640bf9d9bf14449e59ce41 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -125,7 +125,12 @@ public:
const GrDrawTargetCaps& caps) = 0;
struct BlendInfo {
- BlendInfo() : fWriteColor(true) {}
+ void reset() {
+ fSrcBlend = kOne_GrBlendCoeff;
+ fDstBlend = kZero_GrBlendCoeff;
+ fBlendConstant = 0;
+ fWriteColor = true;
+ }
GrBlendCoeff fSrcBlend;
GrBlendCoeff fDstBlend;
@@ -133,7 +138,10 @@ public:
bool fWriteColor;
};
- virtual void getBlendInfo(BlendInfo* blendInfo) const = 0;
+ void getBlendInfo(BlendInfo* blendInfo) const {
+ blendInfo->reset();
+ this->onGetBlendInfo(blendInfo);
+ }
bool willReadDstColor() const { return fWillReadDstColor; }
@@ -194,6 +202,13 @@ private:
virtual void onGetGLProcessorKey(const GrGLCaps& caps,
GrProcessorKeyBuilder* b) const = 0;
+ /**
+ * Retrieves the hardware blend state required by this Xfer processor. The BlendInfo struct
+ * comes initialized to default values, so the Xfer processor only needs to set the state it
+ * needs. It may not even need to override this method at all.
+ */
+ virtual void onGetBlendInfo(BlendInfo*) const {}
+
virtual bool onIsEqual(const GrXferProcessor&) const = 0;
bool fWillReadDstColor;
« no previous file with comments | « no previous file | src/effects/SkArithmeticMode_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698