Allow Srcs to veto Sinks based on their broad type.

This breaks Sinks down into three auto-detected types:
  - GPU:    anything that requests to be run in the GPU enclave
  - Vector: anything that writes to the stream instead of the bitmap
  - Raster: everything else

Some examples: gpu -> GPU, msaa16 -> GPU, 8888 -> raster, pdf -> vector,
               svg -> vector, pipe-8888 -> raster, tiles_rt-gpu -> GPU

This lets image decoding sinks veto non-raster backends explicitly,
and can let particular GMs veto GPU or non-GPU sinks as they like.

BUG=skia:

Review URL: https://codereview.chromium.org/1239953004
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index fd13313..cbf7a0b 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -71,14 +71,14 @@
     , fScale(scale)
 {}
 
-Error CodecSrc::draw(SkCanvas* canvas) const {
-    SkImageInfo canvasInfo;
-    if (NULL == canvas->peekPixels(&canvasInfo, NULL)) {
-        // TODO: Once we implement GPU paths (e.g. JPEG YUV), we should use a deferred decode to
-        // let the GPU handle it.
-        return Error::Nonfatal("No need to test decoding to non-raster backend.");
-    }
+bool CodecSrc::veto(SinkType type) const {
+    // No need to test decoding to non-raster backend.
+    // TODO: Once we implement GPU paths (e.g. JPEG YUV), we should use a deferred decode to
+    // let the GPU handle it.
+    return type != kRaster_SinkType;
+}
 
+Error CodecSrc::draw(SkCanvas* canvas) const {
     SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
     if (!encoded) {
         return SkStringPrintf("Couldn't read %s.", fPath.c_str());
@@ -90,7 +90,7 @@
 
     // Choose the color type to decode to
     SkImageInfo decodeInfo = codec->getInfo();
-    SkColorType canvasColorType = canvasInfo.colorType();
+    SkColorType canvasColorType = canvas->imageInfo().colorType();
     switch (fDstColorType) {
         case kIndex8_Always_DstColorType:
             decodeInfo = codec->getInfo().makeColorType(kIndex_8_SkColorType);
@@ -459,18 +459,18 @@
 
 ImageSrc::ImageSrc(Path path, int divisor) : fPath(path), fDivisor(divisor) {}
 
-Error ImageSrc::draw(SkCanvas* canvas) const {
-    SkImageInfo canvasInfo;
-    if (NULL == canvas->peekPixels(&canvasInfo, NULL)) {
-        // TODO: Instead, use lazy decoding to allow the GPU to handle cases like YUV.
-        return Error::Nonfatal("No need to test decoding to non-raster backend.");
-    }
+bool ImageSrc::veto(SinkType type) const {
+    // No need to test decoding to non-raster backend.
+    // TODO: Instead, use lazy decoding to allow the GPU to handle cases like YUV.
+    return type != kRaster_SinkType;
+}
 
+Error ImageSrc::draw(SkCanvas* canvas) const {
     SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
     if (!encoded) {
         return SkStringPrintf("Couldn't read %s.", fPath.c_str());
     }
-    const SkColorType dstColorType = canvasInfo.colorType();
+    const SkColorType dstColorType = canvas->imageInfo().colorType();
     if (fDivisor == 0) {
         // Decode the full image.
         SkBitmap bitmap;