Chromium Code Reviews| Index: dm/DMSrcSink.cpp |
| diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
| index 7ccaf223fc3a32b8e2baa867dcd575454332b6ec..bd881e8381739a1c723f8014ed0859fa0a747473 100644 |
| --- a/dm/DMSrcSink.cpp |
| +++ b/dm/DMSrcSink.cpp |
| @@ -522,6 +522,31 @@ Error CodecSrc::draw(SkCanvas* canvas) const { |
| canvas->drawBitmap(bitmap, 0, 0); |
| break; |
| } |
| + case kCroppedScanline_Mode: { |
| + const int width = decodeInfo.width(); |
| + const int height = decodeInfo.height(); |
| + // This value is chosen because, as we move across the image, it will sometimes |
| + // align with the jpeg block sizes and it will sometimes not. This allows us |
|
scroggo
2016/02/22 18:46:47
Is this because it is not a multiple of 8? (But fo
msarett
2016/02/22 19:07:43
The block size is generally 8 or 16. And the requ
scroggo
2016/02/22 19:20:20
Ah, so if width changes, it will be to add origina
|
| + // to test interestingly different code paths in the implementation. |
| + const int tileSize = 36; |
| + |
| + SkCodec::Options opts; |
| + SkIRect subset; |
| + for (int x = 0; x < width; x += tileSize) { |
| + subset = SkIRect::MakeXYWH(x, 0, SkTMin(tileSize, width - x), height); |
| + opts.fSubset = ⊂ |
| + if (SkCodec::kSuccess != codec->startScanlineDecode(decodeInfo, &opts, |
| + colorPtr, colorCountPtr)) { |
| + return "Could not start scanline decoder."; |
| + } |
| + |
| + codec->getScanlines(bitmap.getAddr(x, 0), height, bitmap.rowBytes()); |
| + } |
| + |
| + premultiply_if_necessary(bitmap); |
| + canvas->drawBitmap(bitmap, 0, 0); |
| + break; |
| + } |
| case kSubset_Mode: { |
| // Arbitrarily choose a divisor. |
| int divisor = 2; |