Index: include/gpu/GrXferProcessor.h |
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h |
index 13e4d2633ff30045b816db20b999744953a20ee7..c26e5a5359bab323d18522240f7850c7fd537c0f 100644 |
--- a/include/gpu/GrXferProcessor.h |
+++ b/include/gpu/GrXferProcessor.h |
@@ -10,6 +10,7 @@ |
#include "GrColor.h" |
#include "GrProcessor.h" |
+#include "GrTexture.h" |
#include "GrTypes.h" |
#include "SkXfermode.h" |
@@ -34,11 +35,10 @@ class GrProcOptInfo; |
class GrXferProcessor : public GrProcessor { |
public: |
/** |
- * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this xfer |
- * processor's GL backend implementation. |
- */ |
- virtual void getGLProcessorKey(const GrGLCaps& caps, |
- GrProcessorKeyBuilder* b) const = 0; |
+ * Sets a unique key on the GrProcessorKeyBuilder calls onGetGLProcessorKey(...) to get the |
+ * sepcific subclasses key. |
bsalomon
2015/01/30 14:59:14
specific subclass's ?
egdaniel
2015/02/03 16:47:43
Done.
|
+ */ |
+ void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const; |
/** Returns a new instance of the appropriate *GL* implementation class |
for the given GrXferProcessor; caller is responsible for deleting |
@@ -106,6 +106,13 @@ public: |
/** Will this prceossor read the destination pixel value? */ |
bool willReadDstColor() const { return fWillReadDstColor; } |
+ bool hasDstCopy() const; |
bsalomon
2015/01/30 14:59:14
different than (bool)getDstCopyTexture()?
egdaniel
2015/02/03 16:47:43
Removed hasDstCopy
|
+ bool dstCopyIsTopDown() const; |
bsalomon
2015/01/30 14:59:14
can't we just canonicalize this?
egdaniel
2015/02/03 16:47:43
done
|
+ |
+ const GrTexture* getDstCopyTexture() const { return fDstCopy.getTexture(); } |
bsalomon
2015/01/30 14:59:14
comments?
egdaniel
2015/02/03 16:47:43
Done.
|
+ |
+ const SkIPoint& offset() const { return fOffset; } |
bsalomon
2015/01/30 14:59:14
offset() is a bit vague...
egdaniel
2015/02/03 16:47:43
made name more descriptive "DstcopyTextureOffset"
|
+ |
/** |
* Returns whether or not this xferProcossor will set a secondary output to be used with dual |
* source blending. |
@@ -123,11 +130,18 @@ public: |
if (this->classID() != that.classID()) { |
return false; |
} |
+ if (this->fDstCopy.getTexture() != that.fDstCopy.getTexture()) { |
+ return false; |
+ } |
+ if (this->fOffset != that.fOffset) { |
+ return false; |
+ } |
return this->onIsEqual(that); |
} |
protected: |
- GrXferProcessor() : fWillReadDstColor(false) {} |
+ GrXferProcessor(); |
+ GrXferProcessor(const GrDeviceCoordTexture* dstCopy, int32_t dstReadKey); |
/** |
* If the prceossor subclass will read the destination pixel value then it must call this |
@@ -137,15 +151,27 @@ protected: |
void setWillReadDstColor() { fWillReadDstColor = true; } |
private: |
+ /** |
+ * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this xfer |
+ * processor's GL backend implementation. |
+ */ |
+ virtual void onGetGLProcessorKey(const GrGLCaps& caps, |
+ GrProcessorKeyBuilder* b) const = 0; |
+ |
virtual bool onIsEqual(const GrXferProcessor&) const = 0; |
- bool fWillReadDstColor; |
+ bool fWillReadDstColor; |
+ uint32_t fDstReadKey; |
+ GrTextureAccess fDstCopy; |
+ SkIPoint fOffset; |
typedef GrFragmentProcessor INHERITED; |
}; |
GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); |
+/////////////////////////////////////////////////////////////////////////////// |
+ |
/** |
* We install a GrXPFactory (XPF) early on in the pipeline before all the final draw information is |
* known (e.g. whether there is fractional pixel coverage, will coverage be 1 or 4 channel, is the |
@@ -159,8 +185,10 @@ GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); |
*/ |
class GrXPFactory : public SkRefCnt { |
public: |
- virtual GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI, |
- const GrProcOptInfo& coveragePOI) const = 0; |
+ GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI, |
+ const GrProcOptInfo& coveragePOI, |
+ const GrDeviceCoordTexture* dstCopy, |
+ const GrDrawTargetCaps& caps) const; |
/** |
* This function returns true if the GrXferProcessor generated from this factory will be able to |
@@ -202,10 +230,7 @@ public: |
*/ |
virtual bool canTweakAlphaForCoverage() const = 0; |
- /** |
- * Returns true if the XP generated by this factory will read dst. |
- */ |
- virtual bool willReadDst() const = 0; |
+ bool willNeedDstCopy(const GrDrawTargetCaps& caps) const; |
bool isEqual(const GrXPFactory& that) const { |
if (this->classID() != that.classID()) { |
@@ -232,6 +257,15 @@ protected: |
uint32_t fClassID; |
private: |
+ virtual GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI, |
+ const GrProcOptInfo& coveragePOI, |
+ const GrDeviceCoordTexture* dstCopy, |
+ int32_t dstReadKey) const = 0; |
+ /** |
+ * Returns true if the XP generated by this factory will read dst. |
+ */ |
+ virtual bool willReadDst() const = 0; |
bsalomon
2015/01/30 14:59:14
maybe make it clear that this refers to reading th
egdaniel
2015/02/03 16:47:43
Done.
|
+ |
virtual bool onIsEqual(const GrXPFactory&) const = 0; |
static uint32_t GenClassID() { |