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

Side by Side Diff: tests/SkpSkGrTest.cpp

Issue 161733002: add peekPixels to SkCanvas and SkSurface (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 | « src/image/SkSurface.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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 desc.fSampleCnt = 0; 446 desc.fSampleCnt = 0;
447 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NUL L, 0)); 447 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NUL L, 0));
448 if (!texture) { 448 if (!texture) {
449 SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilenam e, 449 SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilenam e,
450 dim.fX, dim.fY); 450 dim.fX, dim.fY);
451 goto finish; 451 goto finish;
452 } 452 }
453 SkGpuDevice grDevice(context, texture.get()); 453 SkGpuDevice grDevice(context, texture.get());
454 SkCanvas grCanvas(&grDevice); 454 SkCanvas grCanvas(&grDevice);
455 drawPict(pic, &grCanvas, fScaleOversized ? scale : 1); 455 drawPict(pic, &grCanvas, fScaleOversized ? scale : 1);
456 const SkBitmap& grBitmap = grDevice.accessBitmap(false); 456
457 SkBitmap grBitmap;
458 grBitmap.allocPixels(grCanvas.imageInfo());
459 grCanvas.readPixels(&grBitmap, 0, 0);
460
457 if (fTestStep == kCompareBits) { 461 if (fTestStep == kCompareBits) {
458 fPixelError = similarBits(grBitmap, bitmap); 462 fPixelError = similarBits(grBitmap, bitmap);
459 int skTime = timePict(pic, &skCanvas); 463 int skTime = timePict(pic, &skCanvas);
460 int grTime = timePict(pic, &grCanvas); 464 int grTime = timePict(pic, &grCanvas);
461 fTime = skTime - grTime; 465 fTime = skTime - grTime;
462 } else if (fTestStep == kEncodeFiles) { 466 } else if (fTestStep == kEncodeFiles) {
463 SkString pngStr = make_png_name(fFilename); 467 SkString pngStr = make_png_name(fFilename);
464 const char* pngName = pngStr.c_str(); 468 const char* pngName = pngStr.c_str();
465 writePict(grBitmap, outGrDir, pngName); 469 writePict(grBitmap, outGrDir, pngName);
466 writePict(bitmap, outSkDir, pngName); 470 writePict(bitmap, outSkDir, pngName);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 int testIndex = 166; 746 int testIndex = 166;
743 int dirIndex = skipOverSkGr[testIndex - 166].directory; 747 int dirIndex = skipOverSkGr[testIndex - 166].directory;
744 SkString pictDir = make_in_dir_name(dirIndex); 748 SkString pictDir = make_in_dir_name(dirIndex);
745 if (pictDir.size() == 0) { 749 if (pictDir.size() == 0) {
746 return; 750 return;
747 } 751 }
748 SkString filename(skipOverSkGr[testIndex - 166].filename); 752 SkString filename(skipOverSkGr[testIndex - 166].filename);
749 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose ()); 753 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose ());
750 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose ()); 754 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose ());
751 } 755 }
OLDNEW
« no previous file with comments | « src/image/SkSurface.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698