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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 SkDecodingImageGenerator::Create(stream, opts), bitmap)) { | 496 SkDecodingImageGenerator::Create(stream, opts), bitmap)) { |
497 return bitmap->pixelRef(); | 497 return bitmap->pixelRef(); |
498 } | 498 } |
499 return NULL; | 499 return NULL; |
500 } | 500 } |
501 /** | 501 /** |
502 * A test for the SkDecodingImageGenerator::Create and | 502 * A test for the SkDecodingImageGenerator::Create and |
503 * SkInstallDiscardablePixelRef functions. | 503 * SkInstallDiscardablePixelRef functions. |
504 */ | 504 */ |
505 DEF_TEST(ImprovedBitmapFactory, reporter) { | 505 DEF_TEST(ImprovedBitmapFactory, reporter) { |
506 SkString resourcePath = GetResourcePath(); | 506 SkString pngFilename = GetResourcePath("randPixels.png"); |
507 SkString path = SkOSPath::SkPathJoin( | 507 SkAutoTUnref<SkStreamRewindable> stream(SkStream::NewFromFile(pngFilename.c_
str())); |
508 resourcePath.c_str(), "randPixels.png"); | 508 if (sk_exists(pngFilename.c_str())) { |
509 SkAutoTUnref<SkStreamRewindable> stream( | |
510 SkStream::NewFromFile(path.c_str())); | |
511 if (sk_exists(path.c_str())) { | |
512 SkBitmap bm; | 509 SkBitmap bm; |
513 SkAssertResult(bm.setInfo(SkImageInfo::MakeN32Premul(1, 1))); | 510 SkAssertResult(bm.setInfo(SkImageInfo::MakeN32Premul(1, 1))); |
514 REPORTER_ASSERT(reporter, | 511 REPORTER_ASSERT(reporter, |
515 NULL != install_pixel_ref(&bm, stream.detach(), 1, true)); | 512 NULL != install_pixel_ref(&bm, stream.detach(), 1, true)); |
516 SkAutoLockPixels alp(bm); | 513 SkAutoLockPixels alp(bm); |
517 REPORTER_ASSERT(reporter, NULL != bm.getPixels()); | 514 REPORTER_ASSERT(reporter, NULL != bm.getPixels()); |
518 } | 515 } |
519 } | 516 } |
520 | 517 |
521 | 518 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 716 } |
720 SkDecodingImageGenerator::Options options(scaleList[i], | 717 SkDecodingImageGenerator::Options options(scaleList[i], |
721 ditherList[j]); | 718 ditherList[j]); |
722 test_options(reporter, options, encodedStream, encodedData, | 719 test_options(reporter, options, encodedStream, encodedData, |
723 useDataList[m], path); | 720 useDataList[m], path); |
724 } | 721 } |
725 } | 722 } |
726 } | 723 } |
727 } | 724 } |
728 } | 725 } |
OLD | NEW |