OLD | NEW |
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 Loading... |
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 | 456 const SkBitmap& grBitmap = grDevice.accessBitmap(false); |
457 SkBitmap grBitmap; | |
458 grBitmap.allocPixels(grCanvas.imageInfo()); | |
459 grCanvas.readPixels(&grBitmap, 0, 0); | |
460 | |
461 if (fTestStep == kCompareBits) { | 457 if (fTestStep == kCompareBits) { |
462 fPixelError = similarBits(grBitmap, bitmap); | 458 fPixelError = similarBits(grBitmap, bitmap); |
463 int skTime = timePict(pic, &skCanvas); | 459 int skTime = timePict(pic, &skCanvas); |
464 int grTime = timePict(pic, &grCanvas); | 460 int grTime = timePict(pic, &grCanvas); |
465 fTime = skTime - grTime; | 461 fTime = skTime - grTime; |
466 } else if (fTestStep == kEncodeFiles) { | 462 } else if (fTestStep == kEncodeFiles) { |
467 SkString pngStr = make_png_name(fFilename); | 463 SkString pngStr = make_png_name(fFilename); |
468 const char* pngName = pngStr.c_str(); | 464 const char* pngName = pngStr.c_str(); |
469 writePict(grBitmap, outGrDir, pngName); | 465 writePict(grBitmap, outGrDir, pngName); |
470 writePict(bitmap, outSkDir, pngName); | 466 writePict(bitmap, outSkDir, pngName); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 int testIndex = 166; | 742 int testIndex = 166; |
747 int dirIndex = skipOverSkGr[testIndex - 166].directory; | 743 int dirIndex = skipOverSkGr[testIndex - 166].directory; |
748 SkString pictDir = make_in_dir_name(dirIndex); | 744 SkString pictDir = make_in_dir_name(dirIndex); |
749 if (pictDir.size() == 0) { | 745 if (pictDir.size() == 0) { |
750 return; | 746 return; |
751 } | 747 } |
752 SkString filename(skipOverSkGr[testIndex - 166].filename); | 748 SkString filename(skipOverSkGr[testIndex - 166].filename); |
753 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose
()); | 749 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose
()); |
754 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose
()); | 750 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose
()); |
755 } | 751 } |
OLD | NEW |