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

Side by Side Diff: tests/SkpSkGrTest.cpp

Issue 162643002: replace setConfig+allocPixels with single call (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « tests/ShaderOpacityTest.cpp ('k') | tests/SurfaceTest.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 #if !SK_SUPPORT_GPU 1 #if !SK_SUPPORT_GPU
2 #error "GPU support required" 2 #error "GPU support required"
3 #endif 3 #endif
4 4
5 #include "GrContext.h" 5 #include "GrContext.h"
6 #include "GrContextFactory.h" 6 #include "GrContextFactory.h"
7 #include "GrRenderTarget.h" 7 #include "GrRenderTarget.h"
8 #include "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 #include "gl/GrGLDefines.h" 9 #include "gl/GrGLDefines.h"
10 10
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 int maxWH = context->getMaxRenderTargetSize(); 418 int maxWH = context->getMaxRenderTargetSize();
419 int scale = 1; 419 int scale = 1;
420 while (pLargerWH / scale > maxWH) { 420 while (pLargerWH / scale > maxWH) {
421 scale *= 2; 421 scale *= 2;
422 } 422 }
423 SkBitmap bitmap; 423 SkBitmap bitmap;
424 SkIPoint dim; 424 SkIPoint dim;
425 do { 425 do {
426 dim.fX = (pWidth + scale - 1) / scale; 426 dim.fX = (pWidth + scale - 1) / scale;
427 dim.fY = (pHeight + scale - 1) / scale; 427 dim.fY = (pHeight + scale - 1) / scale;
428 bitmap.setConfig(SkBitmap::kARGB_8888_Config, dim.fX, dim.fY); 428 bool success = bitmap.allocN32Pixels(, dim.fX, dim.fY);
429 bool success = bitmap.allocPixels();
430 if (success) { 429 if (success) {
431 break; 430 break;
432 } 431 }
433 SkDebugf("-%d-", scale); 432 SkDebugf("-%d-", scale);
434 } while ((scale *= 2) < 256); 433 } while ((scale *= 2) < 256);
435 if (scale >= 256) { 434 if (scale >= 256) {
436 SkDebugf("unable to allocate bitmap for %s (w=%d h=%d) (sw=%d sh=%d) \n", 435 SkDebugf("unable to allocate bitmap for %s (w=%d h=%d) (sw=%d sh=%d) \n",
437 fFilename, pWidth, pHeight, dim.fX, dim.fY); 436 fFilename, pWidth, pHeight, dim.fX, dim.fY);
438 goto finish; 437 goto finish;
439 } 438 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 int testIndex = 166; 742 int testIndex = 166;
744 int dirIndex = skipOverSkGr[testIndex - 166].directory; 743 int dirIndex = skipOverSkGr[testIndex - 166].directory;
745 SkString pictDir = make_in_dir_name(dirIndex); 744 SkString pictDir = make_in_dir_name(dirIndex);
746 if (pictDir.size() == 0) { 745 if (pictDir.size() == 0) {
747 return; 746 return;
748 } 747 }
749 SkString filename(skipOverSkGr[testIndex - 166].filename); 748 SkString filename(skipOverSkGr[testIndex - 166].filename);
750 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose ()); 749 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose ());
751 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose ()); 750 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose ());
752 } 751 }
OLDNEW
« no previous file with comments | « tests/ShaderOpacityTest.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698