| OLD | NEW |
| 1 #include "DMGpuGMTask.h" | 1 #include "DMGpuGMTask.h" |
| 2 | |
| 3 #include "DMUtil.h" | 2 #include "DMUtil.h" |
| 4 #include "DMWriteTask.h" | 3 #include "DMWriteTask.h" |
| 5 #include "SkCommandLineFlags.h" | 4 #include "SkCommandLineFlags.h" |
| 6 #include "SkSurface.h" | 5 #include "SkSurface.h" |
| 7 #include "SkTLS.h" | 6 #include "SkTLS.h" |
| 8 | 7 |
| 9 namespace DM { | 8 namespace DM { |
| 10 | 9 |
| 11 GpuGMTask::GpuGMTask(const char* config, | 10 GpuGMTask::GpuGMTask(const char* config, |
| 12 Reporter* reporter, | 11 Reporter* reporter, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 28 SkScalarCeilToInt(fGM->height()), | 27 SkScalarCeilToInt(fGM->height()), |
| 29 kN32_SkColorType, | 28 kN32_SkColorType, |
| 30 kPremul_SkAlphaType); | 29 kPremul_SkAlphaType); |
| 31 SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, fGpuA
PI, info, | 30 SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, fGpuA
PI, info, |
| 32 fSampleCount)); | 31 fSampleCount)); |
| 33 if (!surface) { | 32 if (!surface) { |
| 34 this->fail("Could not create context for the config and the api."); | 33 this->fail("Could not create context for the config and the api."); |
| 35 return; | 34 return; |
| 36 } | 35 } |
| 37 SkCanvas* canvas = surface->getCanvas(); | 36 SkCanvas* canvas = surface->getCanvas(); |
| 37 CanvasPreflight(canvas); |
| 38 | 38 |
| 39 canvas->concat(fGM->getInitialTransform()); | 39 canvas->concat(fGM->getInitialTransform()); |
| 40 fGM->draw(canvas); | 40 fGM->draw(canvas); |
| 41 canvas->flush(); | 41 canvas->flush(); |
| 42 | 42 |
| 43 SkBitmap bitmap; | 43 SkBitmap bitmap; |
| 44 bitmap.setInfo(info); | 44 bitmap.setInfo(info); |
| 45 canvas->readPixels(&bitmap, 0, 0); | 45 canvas->readPixels(&bitmap, 0, 0); |
| 46 | 46 |
| 47 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "GM", bitmap))); | 47 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "GM", bitmap))); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool GpuGMTask::shouldSkip() const { | 50 bool GpuGMTask::shouldSkip() const { |
| 51 return kGPUDisabled || SkToBool(fGM->getFlags() & skiagm::GM::kSkipGPU_Flag)
; | 51 return kGPUDisabled || SkToBool(fGM->getFlags() & skiagm::GM::kSkipGPU_Flag)
; |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace DM | 54 } // namespace DM |
| OLD | NEW |