Apply coverage in XP base class when using dst reads

Moves the coverage logic into GrGLXferProcessor for XPs that perform
dst reads. XPs that don't use a dst read are still responsible to
handle coverage on their own.

BUG=skia:

Review URL: https://codereview.chromium.org/1170553002
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
index e771f64..837e13e 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -6,6 +6,7 @@
  */
 
 #include "GrXferProcessor.h"
+#include "GrProcOptInfo.h"
 #include "gl/GrGLCaps.h"
 
 GrXferProcessor::GrXferProcessor()
@@ -17,6 +18,7 @@
     , fReadsCoverage(true)
     , fDstTextureOffset() {
     if (dstTexture && dstTexture->texture()) {
+        SkASSERT(willReadDstColor);
         fDstTexture.reset(dstTexture->texture());
         fDstTextureOffset = dstTexture->offset();
         this->addTextureAccess(&fDstTexture);
@@ -35,17 +37,45 @@
                                                                overrideColor,
                                                                caps);
 
+    if (this->willReadDstColor()) {
+        // When performing a dst read we handle coverage in the base class.
+        SkASSERT(!(flags & GrXferProcessor::kIgnoreCoverage_OptFlag));
+        if (coveragePOI.isSolidWhite()) {
+            flags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
+        }
+    }
     if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
         fReadsCoverage = false;
     }
     return flags;
 }
 
+bool GrXferProcessor::hasSecondaryOutput() const {
+    if (!this->willReadDstColor()) {
+        return this->onHasSecondaryOutput();
+    }
+    return false;
+}
+
+void GrXferProcessor::getBlendInfo(BlendInfo* blendInfo) const {
+    blendInfo->reset();
+    if (!this->willReadDstColor()) {
+        this->onGetBlendInfo(blendInfo);
+    }
+}
+
 void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const {
     uint32_t key = this->willReadDstColor() ? 0x1 : 0x0;
-    if (this->getDstTexture() &&
-        kTopLeft_GrSurfaceOrigin == this->getDstTexture()->origin()) {
-        key |= 0x2;
+    if (key) {
+        if (this->getDstTexture()) {
+            key |= 0x2;
+        }
+        if (kTopLeft_GrSurfaceOrigin == this->getDstTexture()->origin()) {
+            key |= 0x4;
+        }
+        if (this->readsCoverage()) {
+            key |= 0x8;
+        }
     }
     b->add32(key);
     this->onGetGLProcessorKey(caps, b);