| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 // ICO | 463 // ICO |
| 464 // FIXME: We are not ready to test incomplete ICOs | 464 // FIXME: We are not ready to test incomplete ICOs |
| 465 // These two tests examine interestingly different behavior: | 465 // These two tests examine interestingly different behavior: |
| 466 // Decodes an embedded BMP image | 466 // Decodes an embedded BMP image |
| 467 check(r, "color_wheel.ico", SkISize::Make(128, 128), true, false, false); | 467 check(r, "color_wheel.ico", SkISize::Make(128, 128), true, false, false); |
| 468 // Decodes an embedded PNG image | 468 // Decodes an embedded PNG image |
| 469 check(r, "google_chrome.ico", SkISize::Make(256, 256), false, false, false,
true); | 469 check(r, "google_chrome.ico", SkISize::Make(256, 256), false, false, false,
true); |
| 470 | 470 |
| 471 // GIF | 471 // GIF |
| 472 // FIXME: We are not ready to test incomplete GIFs | 472 // FIXME: We are not ready to test incomplete GIFs |
| 473 check(r, "box.gif", SkISize::Make(200, 55), true, false, false); | 473 check(r, "box.gif", SkISize::Make(200, 55), false, false, false); |
| 474 check(r, "color_wheel.gif", SkISize::Make(128, 128), true, false, false); | 474 check(r, "color_wheel.gif", SkISize::Make(128, 128), false, false, false); |
| 475 // randPixels.gif is too small to test incomplete | 475 // randPixels.gif is too small to test incomplete |
| 476 check(r, "randPixels.gif", SkISize::Make(8, 8), true, false, false); | 476 check(r, "randPixels.gif", SkISize::Make(8, 8), false, false, false); |
| 477 | 477 |
| 478 // JPG | 478 // JPG |
| 479 check(r, "CMYK.jpg", SkISize::Make(642, 516), true, false, true); | 479 check(r, "CMYK.jpg", SkISize::Make(642, 516), true, false, true); |
| 480 check(r, "color_wheel.jpg", SkISize::Make(128, 128), true, false, true); | 480 check(r, "color_wheel.jpg", SkISize::Make(128, 128), true, false, true); |
| 481 // grayscale.jpg is too small to test incomplete | 481 // grayscale.jpg is too small to test incomplete |
| 482 check(r, "grayscale.jpg", SkISize::Make(128, 128), true, false, false); | 482 check(r, "grayscale.jpg", SkISize::Make(128, 128), true, false, false); |
| 483 check(r, "mandrill_512_q075.jpg", SkISize::Make(512, 512), true, false, true
); | 483 check(r, "mandrill_512_q075.jpg", SkISize::Make(512, 512), true, false, true
); |
| 484 // randPixels.jpg is too small to test incomplete | 484 // randPixels.jpg is too small to test incomplete |
| 485 check(r, "randPixels.jpg", SkISize::Make(8, 8), true, false, false); | 485 check(r, "randPixels.jpg", SkISize::Make(8, 8), true, false, false); |
| 486 | 486 |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 } | 1259 } |
| 1260 }; | 1260 }; |
| 1261 | 1261 |
| 1262 DEF_TEST(Codec_fallBack, r) { | 1262 DEF_TEST(Codec_fallBack, r) { |
| 1263 // SkAndroidCodec needs to be able to fall back to scanline decoding | 1263 // SkAndroidCodec needs to be able to fall back to scanline decoding |
| 1264 // if incremental decoding does not work. Make sure this does not | 1264 // if incremental decoding does not work. Make sure this does not |
| 1265 // require a rewind. | 1265 // require a rewind. |
| 1266 | 1266 |
| 1267 // Formats that currently do not support incremental decoding | 1267 // Formats that currently do not support incremental decoding |
| 1268 auto files = { | 1268 auto files = { |
| 1269 "box.gif", | 1269 // FIXME: box.gif does not currently support either. |
| 1270 // "box.gif", |
| 1270 "CMYK.jpg", | 1271 "CMYK.jpg", |
| 1271 "color_wheel.ico", | 1272 "color_wheel.ico", |
| 1272 "mandrill.wbmp", | 1273 "mandrill.wbmp", |
| 1273 "randPixels.bmp", | 1274 "randPixels.bmp", |
| 1274 }; | 1275 }; |
| 1275 for (auto file : files) { | 1276 for (auto file : files) { |
| 1276 SkStream* stream = LimitedRewindingStream::Make(file, 14); | 1277 SkStream* stream = LimitedRewindingStream::Make(file, 14); |
| 1277 if (!stream) { | 1278 if (!stream) { |
| 1278 SkDebugf("Missing resources (%s). Set --resourcePath.\n", file); | 1279 SkDebugf("Missing resources (%s). Set --resourcePath.\n", file); |
| 1279 return; | 1280 return; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1295 continue; | 1296 continue; |
| 1296 } | 1297 } |
| 1297 | 1298 |
| 1298 // Scanline decoding should not require a rewind. | 1299 // Scanline decoding should not require a rewind. |
| 1299 SkCodec::Result result = codec->startScanlineDecode(info); | 1300 SkCodec::Result result = codec->startScanlineDecode(info); |
| 1300 if (SkCodec::kSuccess != result) { | 1301 if (SkCodec::kSuccess != result) { |
| 1301 ERRORF(r, "Scanline decoding failed for %s with %i", file, result); | 1302 ERRORF(r, "Scanline decoding failed for %s with %i", file, result); |
| 1302 } | 1303 } |
| 1303 } | 1304 } |
| 1304 } | 1305 } |
| OLD | NEW |