aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-12-18 12:44:55 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-18 12:44:55 -0800
commit9e4ecdc9f86724dcce23dc7546e2f295b901407b (patch)
tree9b3178883194b538f6f7371b8b432ca9a5d71514 /include/gpu
parentcaf7e9313b52f78b53ff7d478f9cc41a1f6a85ff (diff)
Add an InvariantOutput for the XPF.
The Invariant output holds information about final post blended color and other general information like will it blend with dst. Having this new struct allowed me to also remove some functions that were previously querying subsets of the invariant output. BUG=skia: Review URL: https://codereview.chromium.org/814933002
Diffstat (limited to 'include/gpu')
-rw-r--r--include/gpu/GrPaint.h14
-rw-r--r--include/gpu/GrXferProcessor.h22
-rw-r--r--include/gpu/effects/GrPorterDuffXferProcessor.h10
3 files changed, 16 insertions, 30 deletions
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 17bb11811f..6862d9dc55 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -142,15 +142,6 @@ public:
}
/**
- * Determines whether the drawing with this paint is opaque with respect to both color blending
- * and fractional coverage. It does not consider whether AA has been enabled on the paint or
- * not. Depending upon whether multisampling or coverage-based AA is in use, AA may make the
- * result only apply to the interior of primitives.
- *
- */
- bool isOpaque() const;
-
- /**
* Returns true if isOpaque would return true and the paint represents a solid constant color
* draw. If the result is true, constantColor will be updated to contain the constant color.
*/
@@ -193,11 +184,6 @@ public:
}
private:
- /**
- * Helper for isOpaque and isOpaqueAndConstantColor.
- */
- bool getOpaqueAndKnownColor(GrColor* solidColor, uint32_t* solidColorKnownComponents) const;
-
friend class GrContext; // To access above two functions
friend class GrStencilAndCoverTextContext; // To access above two functions
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 80e375c03c..98585c6a53 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -180,13 +180,21 @@ public:
virtual bool canApplyCoverage(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
bool colorWriteDisabled) const = 0;
- /**
- * This function returns true if the destination pixel values will be read for blending during
- * draw.
+
+ struct InvariantOutput {
+ bool fWillBlendWithDst;
+ GrColor fBlendedColor;
+ uint32_t fBlendedColorFlags;
+ };
+
+ /**
+ * This function returns known information about the output of the xfer processor produced by
+ * this xp factory. The invariant color information returned by this function refers to the
+ * final color produced after all blending.
*/
// TODO: remove need for colorWriteDisabled once only XP can read dst.
- virtual bool willBlendWithDst(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
- bool colorWriteDisabled) const = 0;
+ virtual void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
+ bool colorWriteDisabled, InvariantOutput*) const = 0;
/**
* Determines whether multiplying the computed per-pixel color by the pixel's fractional
@@ -195,10 +203,6 @@ public:
*/
virtual bool canTweakAlphaForCoverage() const = 0;
- virtual bool getOpaqueAndKnownColor(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI, GrColor* solidColor,
- uint32_t* solidColorKnownComponents) const = 0;
-
bool isEqual(const GrXPFactory& that) const {
if (this->classID() != that.classID()) {
return false;
diff --git a/include/gpu/effects/GrPorterDuffXferProcessor.h b/include/gpu/effects/GrPorterDuffXferProcessor.h
index bcfd935bf2..fab14c732a 100644
--- a/include/gpu/effects/GrPorterDuffXferProcessor.h
+++ b/include/gpu/effects/GrPorterDuffXferProcessor.h
@@ -133,15 +133,11 @@ public:
bool canApplyCoverage(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
bool colorWriteDisabled) const SK_OVERRIDE;
- bool willBlendWithDst(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
- bool colorWriteDisabled) const SK_OVERRIDE;
-
bool canTweakAlphaForCoverage() const SK_OVERRIDE;
- bool getOpaqueAndKnownColor(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- GrColor* solidColor,
- uint32_t* solidColorKnownComponents) const SK_OVERRIDE;
+ void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
+ bool colorWriteDisabled,
+ GrXPFactory::InvariantOutput*) const SK_OVERRIDE;
private:
GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst);