| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 0x68, 0xb6, 0x6d, 0xdb, 0x36, 0x22, 0xfa, 0x1f, 0x35, 0x75, 0x22, 0xec, | 448 0x68, 0xb6, 0x6d, 0xdb, 0x36, 0x22, 0xfa, 0x1f, 0x35, 0x75, 0x22, 0xec, |
| 449 0x31, 0xbc, 0x5d, 0x8f, 0x87, 0x53, 0xa2, 0x05, 0x8c, 0x2f, 0xcd, 0xa8, | 449 0x31, 0xbc, 0x5d, 0x8f, 0x87, 0x53, 0xa2, 0x05, 0x8c, 0x2f, 0xcd, 0xa8, |
| 450 0xa7, 0xf3, 0xa3, 0xbd, 0x83, 0x8b, 0x2a, 0xc8, 0x58, 0xf5, 0xac, 0x80, | 450 0xa7, 0xf3, 0xa3, 0xbd, 0x83, 0x8b, 0x2a, 0xc8, 0x58, 0xf5, 0xac, 0x80, |
| 451 0xe3, 0xfe, 0x66, 0xa4, 0x7c, 0x1b, 0x6c, 0xd1, 0xa9, 0xd8, 0x14, 0xd0, | 451 0xe3, 0xfe, 0x66, 0xa4, 0x7c, 0x1b, 0x6c, 0xd1, 0xa9, 0xd8, 0x14, 0xd0, |
| 452 0xc5, 0xb5, 0x39, 0x71, 0x97, 0x19, 0x19, 0x1b | 452 0xc5, 0xb5, 0x39, 0x71, 0x97, 0x19, 0x19, 0x1b |
| 453 }; | 453 }; |
| 454 SkAutoDataUnref encoded(SkData::NewWithCopy(encodedWebP, | 454 SkAutoDataUnref encoded(SkData::NewWithCopy(encodedWebP, |
| 455 sizeof(encodedWebP))); | 455 sizeof(encodedWebP))); |
| 456 SkBitmap bm; | 456 SkBitmap bm; |
| 457 | 457 |
| 458 bool success = SkInstallDiscardablePixelRef( | 458 bool success = SkInstallDiscardablePixelRef(encoded, &bm); |
| 459 SkDecodingImageGenerator::Create(encoded, | |
| 460 SkDecodingImageGenerator::Options()), &bm); | |
| 461 | 459 |
| 462 REPORTER_ASSERT(reporter, success); | 460 REPORTER_ASSERT(reporter, success); |
| 463 if (!success) { | 461 if (!success) { |
| 464 return; | 462 return; |
| 465 } | 463 } |
| 466 SkAutoLockPixels alp(bm); | 464 SkAutoLockPixels alp(bm); |
| 467 | 465 |
| 468 bool rightSize = ((kExpectedWidth == bm.width()) | 466 bool rightSize = ((kExpectedWidth == bm.width()) |
| 469 && (kExpectedHeight == bm.height())); | 467 && (kExpectedHeight == bm.height())); |
| 470 REPORTER_ASSERT(reporter, rightSize); | 468 REPORTER_ASSERT(reporter, rightSize); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); | 808 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); |
| 811 decoder->setAllocator(allocator); | 809 decoder->setAllocator(allocator); |
| 812 decoder->setSampleSize(2); | 810 decoder->setSampleSize(2); |
| 813 SkBitmap bitmap; | 811 SkBitmap bitmap; |
| 814 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, | 812 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, |
| 815 SkImageDecoder::kDecodePixels_Mode) != SkImag
eDecoder::kFailure; | 813 SkImageDecoder::kDecodePixels_Mode) != SkImag
eDecoder::kFailure; |
| 816 REPORTER_ASSERT(r, success); | 814 REPORTER_ASSERT(r, success); |
| 817 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory | 815 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory |
| 818 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); | 816 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); |
| 819 } | 817 } |
| OLD | NEW |