Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index 38597b6946994c06d8cc24971dc018163ff41b14..24178eede0bcda0925f5937ad83a525354200157 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -71,13 +71,15 @@ CodecSrc::CodecSrc(Path path, Mode mode, DstColorType dstColorType, float scale) |
, fScale(scale) |
{} |
+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 { |
- 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."); |
- } |
+ SkImageInfo canvasInfo = canvas->imageInfo(); |
scroggo
2015/07/17 14:10:48
nit: We now only use canvasInfo once, down below.
|
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
if (!encoded) { |
@@ -382,12 +384,14 @@ Name CodecSrc::name() const { |
ImageSrc::ImageSrc(Path path, int divisor) : fPath(path), fDivisor(divisor) {} |
+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 { |
- 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."); |
- } |
+ SkImageInfo canvasInfo = canvas->imageInfo(); |
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
if (!encoded) { |