Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: tests/JpegTest.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/IndexedPngOverflowTest.cpp ('k') | tests/KtxTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
470 470
471 SkPixelRef* pixelRef = bitmap.pixelRef(); 471 SkPixelRef* pixelRef = bitmap.pixelRef();
472 SkISize yuvSizes[3]; 472 SkISize yuvSizes[3];
473 bool sizesComputed = (NULL != pixelRef) && pixelRef->getYUV8Planes(yuvSizes, NULL, NULL, NULL); 473 bool sizesComputed = (nullptr != pixelRef) && pixelRef->getYUV8Planes(yuvSiz es, nullptr, nullptr, nullptr);
474 REPORTER_ASSERT(reporter, sizesComputed); 474 REPORTER_ASSERT(reporter, sizesComputed);
475 475
476 if (!sizesComputed) { 476 if (!sizesComputed) {
477 return; 477 return;
478 } 478 }
479 479
480 // Allocate the memory for YUV 480 // Allocate the memory for YUV
481 size_t totalSize(0); 481 size_t totalSize(0);
482 size_t sizes[3], rowBytes[3]; 482 size_t sizes[3], rowBytes[3];
483 const int32_t expected_sizes[] = {128, 64, 64}; 483 const int32_t expected_sizes[] = {128, 64, 64};
484 for (int i = 0; i < 3; ++i) { 484 for (int i = 0; i < 3; ++i) {
485 rowBytes[i] = yuvSizes[i].fWidth; 485 rowBytes[i] = yuvSizes[i].fWidth;
486 totalSize += sizes[i] = rowBytes[i] * yuvSizes[i].fHeight; 486 totalSize += sizes[i] = rowBytes[i] * yuvSizes[i].fHeight;
487 REPORTER_ASSERT(reporter, rowBytes[i] == (size_t)expected_sizes[ i]); 487 REPORTER_ASSERT(reporter, rowBytes[i] == (size_t)expected_sizes[ i]);
488 REPORTER_ASSERT(reporter, yuvSizes[i].fWidth == expected_sizes[i]); 488 REPORTER_ASSERT(reporter, yuvSizes[i].fWidth == expected_sizes[i]);
489 REPORTER_ASSERT(reporter, yuvSizes[i].fHeight == expected_sizes[i]); 489 REPORTER_ASSERT(reporter, yuvSizes[i].fHeight == expected_sizes[i]);
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 , nullptr));
499 } 499 }
OLDNEW
« no previous file with comments | « tests/IndexedPngOverflowTest.cpp ('k') | tests/KtxTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698