aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-10-16 10:54:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-16 10:54:12 -0700
commit80803ff615e4293e8af2dc5d094a1f4fa81ec396 (patch)
tree55fd5de502dc7ac897ee6438dd77134115a10048 /tests
parent2e2ea38bb77d42bab292919de5d80286cc354782 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/CodexTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index 91fb6897b5..5ef1f8a86e 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -220,6 +220,26 @@ static void check(skiatest::Reporter* r,
== 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 = &subset;
+
+ 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);
}