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

Side by Side Diff: dm/DMGpuGMTask.cpp

Issue 213093004: Let DM work without a GPU. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « dm/DMGpuGMTask.h ('k') | dm/DMGpuSupport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMGpuGMTask.h" 1 #include "DMGpuGMTask.h"
2 2
3 #include "DMExpectationsTask.h" 3 #include "DMExpectationsTask.h"
4 #include "DMUtil.h" 4 #include "DMUtil.h"
5 #include "DMWriteTask.h" 5 #include "DMWriteTask.h"
6 #include "SkCommandLineFlags.h" 6 #include "SkCommandLineFlags.h"
7 #include "SkSurface.h" 7 #include "SkSurface.h"
8 #include "SkTLS.h" 8 #include "SkTLS.h"
9 9
10 namespace DM { 10 namespace DM {
(...skipping 11 matching lines...) Expand all
22 , fExpectations(expectations) 22 , fExpectations(expectations)
23 , fContextType(contextType) 23 , fContextType(contextType)
24 , fSampleCount(sampleCount) 24 , fSampleCount(sampleCount)
25 {} 25 {}
26 26
27 void GpuGMTask::draw(GrContextFactory* grFactory) { 27 void GpuGMTask::draw(GrContextFactory* grFactory) {
28 SkImageInfo info = SkImageInfo::Make(SkScalarCeilToInt(fGM->width()), 28 SkImageInfo info = SkImageInfo::Make(SkScalarCeilToInt(fGM->width()),
29 SkScalarCeilToInt(fGM->height()), 29 SkScalarCeilToInt(fGM->height()),
30 kPMColor_SkColorType, 30 kPMColor_SkColorType,
31 kPremul_SkAlphaType); 31 kPremul_SkAlphaType);
32 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget( 32 SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, info, fSampleCount));
33 grFactory->get(fContextType), info, fSampleCount));
34 SkCanvas* canvas = surface->getCanvas(); 33 SkCanvas* canvas = surface->getCanvas();
35 34
36 canvas->concat(fGM->getInitialTransform()); 35 canvas->concat(fGM->getInitialTransform());
37 fGM->draw(canvas); 36 fGM->draw(canvas);
38 canvas->flush(); 37 canvas->flush();
39 38
40 SkBitmap bitmap; 39 SkBitmap bitmap;
41 bitmap.setConfig(info); 40 bitmap.setConfig(info);
42 canvas->readPixels(&bitmap, 0, 0); 41 canvas->readPixels(&bitmap, 0, 0);
43 42
44 #if GR_CACHE_STATS
45 gr->printCacheStats();
46 #endif
47
48 this->spawnChild(SkNEW_ARGS(ExpectationsTask, (*this, fExpectations, bitmap) )); 43 this->spawnChild(SkNEW_ARGS(ExpectationsTask, (*this, fExpectations, bitmap) ));
49 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 44 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
50 } 45 }
51 46
52 bool GpuGMTask::shouldSkip() const { 47 bool GpuGMTask::shouldSkip() const {
53 return SkToBool(fGM->getFlags() & skiagm::GM::kSkipGPU_Flag); 48 return kGPUDisabled || SkToBool(fGM->getFlags() & skiagm::GM::kSkipGPU_Flag) ;
54 } 49 }
55 50
56 } // namespace DM 51 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMGpuGMTask.h ('k') | dm/DMGpuSupport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698