Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #include "DMGpuTask.h" | 1 #include "DMGpuTask.h" |
| 2 | 2 |
| 3 #include "DMComparisonTask.h" | 3 #include "DMComparisonTask.h" |
| 4 #include "DMUtil.h" | 4 #include "DMUtil.h" |
| 5 #include "SkCommandLineFlags.h" | 5 #include "SkCommandLineFlags.h" |
| 6 #include "SkGpuDevice.h" | 6 #include "SkGpuDevice.h" |
| 7 #include "SkTLS.h" | 7 #include "SkTLS.h" |
| 8 | 8 |
| 9 namespace DM { | 9 namespace DM { |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 , fConfig(config) | 23 , fConfig(config) |
| 24 , fContextType(contextType) | 24 , fContextType(contextType) |
| 25 , fSampleCount(sampleCount) | 25 , fSampleCount(sampleCount) |
| 26 {} | 26 {} |
| 27 | 27 |
| 28 static void* new_gr_context_factory() { | 28 static void* new_gr_context_factory() { |
| 29 return SkNEW(GrContextFactory); | 29 return SkNEW(GrContextFactory); |
| 30 } | 30 } |
| 31 | 31 |
| 32 static void delete_gr_context_factory(void* factory) { | 32 static void delete_gr_context_factory(void* factory) { |
| 33 return SkDELETE((GrContextFactory*) factory); | 33 SkDELETE((GrContextFactory*) factory); |
| 34 } | 34 } |
| 35 | 35 |
| 36 static GrContextFactory* get_gr_factory() { | 36 static GrContextFactory* get_gr_factory() { |
| 37 return reinterpret_cast<GrContextFactory*>(SkTLS::Get(&new_gr_context_factor y, | 37 return reinterpret_cast<GrContextFactory*>(SkTLS::Get(&new_gr_context_factor y, |
| 38 &delete_gr_context_fac tory)); | 38 &delete_gr_context_fac tory)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void GpuTask::draw() { | 41 void GpuTask::draw() { |
| 42 GrContext* gr = get_gr_factory()->get(fContextType); // Will be owned by de vice. | 42 GrContext* gr = get_gr_factory()->get(fContextType); // Will be owned by de vice. |
| 43 SkGpuDevice device(gr, fConfig, fGM->width(), fGM->height(), fSampleCount); | 43 SkGpuDevice device(gr, fConfig, (int)fGM->width(), (int)fGM->height(), fSamp leCount); |
|
bungeman-skia
2013/10/16 16:00:47
SkScalerCeilToInt
| |
| 44 SkCanvas canvas(&device); | 44 SkCanvas canvas(&device); |
| 45 | 45 |
| 46 canvas.concat(fGM->getInitialTransform()); | 46 canvas.concat(fGM->getInitialTransform()); |
| 47 fGM->draw(&canvas); | 47 fGM->draw(&canvas); |
| 48 canvas.flush(); | 48 canvas.flush(); |
| 49 | 49 |
| 50 SkBitmap bitmap; | 50 SkBitmap bitmap; |
| 51 bitmap.setConfig(fConfig, fGM->width(), fGM->height()); | 51 bitmap.setConfig(fConfig, (int)fGM->width(), (int)fGM->height()); |
| 52 canvas.readPixels(&bitmap, 0, 0); | 52 canvas.readPixels(&bitmap, 0, 0); |
| 53 | 53 |
| 54 // We offload checksum comparison to the main CPU threadpool. | 54 // We offload checksum comparison to the main CPU threadpool. |
| 55 // This cuts run time by about 30%. | 55 // This cuts run time by about 30%. |
| 56 this->spawnChild(SkNEW_ARGS(ComparisonTask, (*this, fExpectations, bitmap))) ; | 56 this->spawnChild(SkNEW_ARGS(ComparisonTask, (*this, fExpectations, bitmap))) ; |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool GpuTask::shouldSkip() const { | 59 bool GpuTask::shouldSkip() const { |
| 60 return fGM->getFlags() & skiagm::GM::kSkipGPU_Flag; | 60 if (fGM->getFlags() & skiagm::GM::kSkipGPU_Flag) { |
|
bungeman-skia
2013/10/16 16:00:47
SkToBool
| |
| 61 return true; | |
| 62 } | |
| 63 return false; | |
| 61 } | 64 } |
| 62 | 65 |
| 63 } // namespace DM | 66 } // namespace DM |
| OLD | NEW |