Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index 75f954f453e07e6d481d072e6cae8b3056b23307..af62dafdd435787d610ecedc64d081214535b4f9 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -372,82 +372,6 @@ Error CodecSrc::draw(SkCanvas* canvas) const { |
canvas->drawBitmap(bitmap, 0, 0); |
break; |
} |
- case kScanline_Subset_Mode: { |
- //this mode decodes the image in divisor*divisor subsets, using a scanline decoder |
- const int divisor = 2; |
- const int w = decodeInfo.width(); |
- const int h = decodeInfo.height(); |
- if (divisor > w || divisor > h) { |
- return Error::Nonfatal(SkStringPrintf("Cannot decode subset: divisor %d is too big" |
- "for %s with dimensions (%d x %d)", divisor, fPath.c_str(), w, h)); |
- } |
- const int subsetWidth = w/divisor; |
- const int subsetHeight = h/divisor; |
- // One of our subsets will be larger to contain any pixels that do not divide evenly. |
- const int extraX = w % divisor; |
- const int extraY = h % divisor; |
- /* |
- * if w or h are not evenly divided by divisor need to adjust width and height of end |
- * subsets to cover entire image. |
- * Add extraX and extraY to largestSubsetBm's width and height to adjust width |
- * and height of end subsets. |
- * subsetBm is extracted from largestSubsetBm. |
- * subsetBm's size is determined based on the current subset and may be larger for end |
- * subsets. |
- */ |
- SkImageInfo largestSubsetDecodeInfo = |
- decodeInfo.makeWH(subsetWidth + extraX, subsetHeight + extraY); |
- SkBitmap largestSubsetBm; |
- if (!largestSubsetBm.tryAllocPixels(largestSubsetDecodeInfo, nullptr, |
- colorTable.get())) { |
- return SkStringPrintf("Image(%s) is too large (%d x %d)\n", fPath.c_str(), |
- largestSubsetDecodeInfo.width(), largestSubsetDecodeInfo.height()); |
- } |
- for (int col = 0; col < divisor; col++) { |
- //currentSubsetWidth may be larger than subsetWidth for rightmost subsets |
- const int currentSubsetWidth = (col + 1 == divisor) ? |
- subsetWidth + extraX : subsetWidth; |
- const int x = col * subsetWidth; |
- for (int row = 0; row < divisor; row++) { |
- //currentSubsetHeight may be larger than subsetHeight for bottom subsets |
- const int currentSubsetHeight = (row + 1 == divisor) ? |
- subsetHeight + extraY : subsetHeight; |
- const int y = row * subsetHeight; |
- //create scanline decoder for each subset |
- SkCodec::Options options; |
- SkIRect subset = SkIRect::MakeXYWH(x, 0, currentSubsetWidth, h); |
- options.fSubset = ⊂ |
- // TODO (msarett): Support this mode for all scanline orderings. |
- if (SkCodec::kSuccess != codec->startScanlineDecode(decodeInfo, &options, |
- colorPtr, colorCountPtr) || |
- SkCodec::kTopDown_SkScanlineOrder != codec->getScanlineOrder()) { |
- if (x == 0 && y == 0) { |
- //first try, image may not be compatible |
- return Error::Nonfatal("Could not start top-down scanline decoder"); |
- } else { |
- return "Error scanline decoder is nullptr"; |
- } |
- } |
- // Skip to the first line of subset. We ignore the result value here. |
- // If the skip value fails, this will indicate an incomplete image. |
- // This means that the call to getScanlines() will also fail, but it |
- // will fill the buffer with a default value, so we can still draw the |
- // image. |
- codec->skipScanlines(y); |
- |
- //create and set size of subsetBm |
- SkBitmap subsetBm; |
- SkIRect bounds = SkIRect::MakeWH(currentSubsetWidth, currentSubsetHeight); |
- SkAssertResult(largestSubsetBm.extractSubset(&subsetBm, bounds)); |
- SkAutoLockPixels autolock(subsetBm, true); |
- codec->getScanlines(subsetBm.getAddr(0, 0), currentSubsetHeight, |
- subsetBm.rowBytes()); |
- subsetBm.notifyPixelsChanged(); |
- canvas->drawBitmap(subsetBm, SkIntToScalar(x), SkIntToScalar(y)); |
- } |
- } |
- break; |
- } |
case kStripe_Mode: { |
const int height = decodeInfo.height(); |
// This value is chosen arbitrarily. We exercise more cases by choosing a value that |