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