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

Side by Side Diff: tests/SkpSkGrTest.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/SkResourceCacheTest.cpp ('k') | tests/SmallAllocatorTest.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 "GrContext.h" 8 #include "GrContext.h"
9 #include "GrContextFactory.h" 9 #include "GrContextFactory.h"
10 #include "GrRenderTarget.h" 10 #include "GrRenderTarget.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn gName) { 375 static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn gName) {
376 SkString outFile = make_filepath(0, outDir, pngName); 376 SkString outFile = make_filepath(0, outDir, pngName);
377 if (!SkImageEncoder::EncodeFile(outFile.c_str(), bitmap, 377 if (!SkImageEncoder::EncodeFile(outFile.c_str(), bitmap,
378 SkImageEncoder::kPNG_Type, 100)) { 378 SkImageEncoder::kPNG_Type, 100)) {
379 SkDebugf("unable to encode gr %s (width=%d height=%d)br \n", pngName, 379 SkDebugf("unable to encode gr %s (width=%d height=%d)br \n", pngName,
380 bitmap.width(), bitmap.height()); 380 bitmap.width(), bitmap.height());
381 } 381 }
382 } 382 }
383 383
384 void TestResult::testOne() { 384 void TestResult::testOne() {
385 SkPicture* pic = NULL; 385 SkPicture* pic = nullptr;
386 { 386 {
387 SkString d; 387 SkString d;
388 d.printf(" {%d, \"%s\"},", fDirNo, fFilename); 388 d.printf(" {%d, \"%s\"},", fDirNo, fFilename);
389 SkString path = make_filepath(fDirNo, IN_DIR, fFilename); 389 SkString path = make_filepath(fDirNo, IN_DIR, fFilename);
390 SkFILEStream stream(path.c_str()); 390 SkFILEStream stream(path.c_str());
391 if (!stream.isValid()) { 391 if (!stream.isValid()) {
392 SkDebugf("invalid stream %s\n", path.c_str()); 392 SkDebugf("invalid stream %s\n", path.c_str());
393 goto finish; 393 goto finish;
394 } 394 }
395 if (fTestStep == kEncodeFiles) { 395 if (fTestStep == kEncodeFiles) {
(...skipping 14 matching lines...) Expand all
410 } 410 }
411 int pWidth = pic->width(); 411 int pWidth = pic->width();
412 int pHeight = pic->height(); 412 int pHeight = pic->height();
413 int pLargerWH = SkTMax(pWidth, pHeight); 413 int pLargerWH = SkTMax(pWidth, pHeight);
414 GrContextFactory contextFactory; 414 GrContextFactory contextFactory;
415 #ifdef SK_BUILD_FOR_WIN 415 #ifdef SK_BUILD_FOR_WIN
416 GrContext* context = contextFactory.get(kAngle); 416 GrContext* context = contextFactory.get(kAngle);
417 #else 417 #else
418 GrContext* context = contextFactory.get(kNative); 418 GrContext* context = contextFactory.get(kNative);
419 #endif 419 #endif
420 if (NULL == context) { 420 if (nullptr == context) {
421 SkDebugf("unable to allocate context for %s\n", fFilename); 421 SkDebugf("unable to allocate context for %s\n", fFilename);
422 goto finish; 422 goto finish;
423 } 423 }
424 int maxWH = context->getMaxRenderTargetSize(); 424 int maxWH = context->getMaxRenderTargetSize();
425 int scale = 1; 425 int scale = 1;
426 while (pLargerWH / scale > maxWH) { 426 while (pLargerWH / scale > maxWH) {
427 scale *= 2; 427 scale *= 2;
428 } 428 }
429 SkBitmap bitmap; 429 SkBitmap bitmap;
430 SkIPoint dim; 430 SkIPoint dim;
(...skipping 12 matching lines...) Expand all
443 goto finish; 443 goto finish;
444 } 444 }
445 SkCanvas skCanvas(bitmap); 445 SkCanvas skCanvas(bitmap);
446 drawPict(pic, &skCanvas, fScaleOversized ? scale : 1); 446 drawPict(pic, &skCanvas, fScaleOversized ? scale : 1);
447 GrTextureDesc desc; 447 GrTextureDesc desc;
448 desc.fConfig = kSkia8888_GrPixelConfig; 448 desc.fConfig = kSkia8888_GrPixelConfig;
449 desc.fFlags = kRenderTarget_GrTextureFlagBit; 449 desc.fFlags = kRenderTarget_GrTextureFlagBit;
450 desc.fWidth = dim.fX; 450 desc.fWidth = dim.fX;
451 desc.fHeight = dim.fY; 451 desc.fHeight = dim.fY;
452 desc.fSampleCnt = 0; 452 desc.fSampleCnt = 0;
453 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NUL L, 0)); 453 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, nul lptr, 0));
454 if (!texture) { 454 if (!texture) {
455 SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilenam e, 455 SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilenam e,
456 dim.fX, dim.fY); 456 dim.fX, dim.fY);
457 goto finish; 457 goto finish;
458 } 458 }
459 SkGpuDevice grDevice(context, texture.get()); 459 SkGpuDevice grDevice(context, texture.get());
460 SkCanvas grCanvas(&grDevice); 460 SkCanvas grCanvas(&grDevice);
461 drawPict(pic, &grCanvas, fScaleOversized ? scale : 1); 461 drawPict(pic, &grCanvas, fScaleOversized ? scale : 1);
462 462
463 SkBitmap grBitmap; 463 SkBitmap grBitmap;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 int testIndex = 166; 751 int testIndex = 166;
752 int dirIndex = skipOverSkGr[testIndex - 166].directory; 752 int dirIndex = skipOverSkGr[testIndex - 166].directory;
753 SkString pictDir = make_in_dir_name(dirIndex); 753 SkString pictDir = make_in_dir_name(dirIndex);
754 if (pictDir.size() == 0) { 754 if (pictDir.size() == 0) {
755 return; 755 return;
756 } 756 }
757 SkString filename(skipOverSkGr[testIndex - 166].filename); 757 SkString filename(skipOverSkGr[testIndex - 166].filename);
758 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose ()); 758 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose ());
759 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose ()); 759 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose ());
760 } 760 }
OLDNEW
« no previous file with comments | « tests/SkResourceCacheTest.cpp ('k') | tests/SmallAllocatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698