Fix SkSwizzler bug
Now, that we are subsetting, fX0 is not necessarily less than
fSrcWidth (since fSrcWidth is really the subset width).
Ex: We may want a 10 pixel subset starting twenty pixels from the
left edge. In that case, fX0=20 and fSrcWidth=10.
Let's rename the width as fSubsetWidth to avoid confusion
and remove the check.
BUG=skia:
Review URL: https://codereview.chromium.org/1407603003
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index 91fb689..5ef1f8a 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -220,6 +220,26 @@
== 0);
REPORTER_ASSERT(r, codec->skipScanlines(1)
== 0);
+
+ // Test partial scanline decodes
+ if (supports_scaled_codec(path) && info.width() >= 3) {
+ SkCodec::Options options;
+ int width = info.width();
+ int height = info.height();
+ SkIRect subset = SkIRect::MakeXYWH(2 * (width / 3), 0, width / 3, height);
+ options.fSubset = ⊂
+
+ const SkCodec::Result partialStartResult = codec->startScanlineDecode(info, &options,
+ nullptr, nullptr);
+ REPORTER_ASSERT(r, partialStartResult == SkCodec::kSuccess);
+
+ for (int y = 0; y < height; y++) {
+ const int lines = codec->getScanlines(bm.getAddr(0, y), 1, 0);
+ if (!isIncomplete) {
+ REPORTER_ASSERT(r, 1 == lines);
+ }
+ }
+ }
} else {
REPORTER_ASSERT(r, startResult == SkCodec::kUnimplemented);
}