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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkDecodingImageGenerator.h" | 9 #include "SkDecodingImageGenerator.h" |
10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 #if JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING | 449 #if JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING |
450 // Check to see that the resulting bitmap is nice | 450 // Check to see that the resulting bitmap is nice |
451 bool writeSuccess = (!(bm8888.empty())) && SkImageEncoder::EncodeFile( | 451 bool writeSuccess = (!(bm8888.empty())) && SkImageEncoder::EncodeFile( |
452 "HalfOfAJpeg.png", bm8888, SkImageEncoder::kPNG_Type, 100); | 452 "HalfOfAJpeg.png", bm8888, SkImageEncoder::kPNG_Type, 100); |
453 SkASSERT(writeSuccess); | 453 SkASSERT(writeSuccess); |
454 #endif | 454 #endif |
455 } | 455 } |
456 | 456 |
457 DEF_TEST(Jpeg_YUV, reporter) { | 457 DEF_TEST(Jpeg_YUV, reporter) { |
458 size_t len = sizeof(goodJpegImage); | 458 size_t len = sizeof(goodJpegImage); |
459 SkMemoryStream* stream = SkNEW_ARGS(SkMemoryStream, (goodJpegImage, len)); | 459 SkMemoryStream* stream = new SkMemoryStream(goodJpegImage, len); |
460 | 460 |
461 SkBitmap bitmap; | 461 SkBitmap bitmap; |
462 SkDecodingImageGenerator::Options opts; | 462 SkDecodingImageGenerator::Options opts; |
463 bool pixelsInstalled = SkInstallDiscardablePixelRef( | 463 bool pixelsInstalled = SkInstallDiscardablePixelRef( |
464 SkDecodingImageGenerator::Create(stream, opts), &bitmap); | 464 SkDecodingImageGenerator::Create(stream, opts), &bitmap); |
465 REPORTER_ASSERT(reporter, pixelsInstalled); | 465 REPORTER_ASSERT(reporter, pixelsInstalled); |
466 | 466 |
467 if (!pixelsInstalled) { | 467 if (!pixelsInstalled) { |
468 return; | 468 return; |
469 } | 469 } |
(...skipping 20 matching lines...) Expand all Loading... |
490 } | 490 } |
491 SkAutoMalloc storage(totalSize); | 491 SkAutoMalloc storage(totalSize); |
492 void* planes[3]; | 492 void* planes[3]; |
493 planes[0] = storage.get(); | 493 planes[0] = storage.get(); |
494 planes[1] = (uint8_t*)planes[0] + sizes[0]; | 494 planes[1] = (uint8_t*)planes[0] + sizes[0]; |
495 planes[2] = (uint8_t*)planes[1] + sizes[1]; | 495 planes[2] = (uint8_t*)planes[1] + sizes[1]; |
496 | 496 |
497 // Get the YUV planes | 497 // Get the YUV planes |
498 REPORTER_ASSERT(reporter, pixelRef->getYUV8Planes(yuvSizes, planes, rowBytes
, NULL)); | 498 REPORTER_ASSERT(reporter, pixelRef->getYUV8Planes(yuvSizes, planes, rowBytes
, NULL)); |
499 } | 499 } |
OLD | NEW |