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

Side by Side Diff: dm/DMGpuSupport.h

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.cpp ('k') | dm/DMTask.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #ifndef DMGpuSupport_DEFINED
2 #define DMGpuSupport_DEFINED
3
4 // Provides Ganesh to DM,
5 // or if it's not available, fakes it enough so most code doesn't have to know t hat.
6
7 #include "SkSurface.h"
8
9 #if SK_SUPPORT_GPU
10
11 // Ganesh is available. Yippee!
12
13 # include "GrContext.h"
14 # include "GrContextFactory.h"
15
16 namespace DM {
17
18 static const bool kGPUDisabled = false;
19
20 static inline SkSurface* NewGpuSurface(GrContextFactory* grFactory,
21 GrContextFactory::GLContextType type,
22 SkImageInfo info,
23 int samples) {
24 return SkSurface::NewRenderTarget(grFactory->get(type), info, samples);
25 }
26
27 } // namespace DM
28
29 #else// !SK_SUPPORT_GPU
30
31 // Ganesh is not available. Fake it.
32
33 class GrContextFactory {
34 public:
35 typedef int GLContextType;
36
37 static const GLContextType kANGLE_GLContextType = 0,
38 kDebug_GLContextType = 0,
39 kMESA_GLContextType = 0,
40 kNVPR_GLContextType = 0,
41 kNative_GLContextType = 0,
42 kNull_GLContextType = 0;
43 };
44
45 namespace DM {
46
47 static const bool kGPUDisabled = true;
48
49 static inline SkSurface* NewGpuSurface(GrContextFactory*,
50 GrContextFactory::GLContextType,
51 SkImageInfo,
52 int) {
53 return NULL;
54 }
55
56 } // namespace DM
57
58 #endif//SK_SUPPORT_GPU
59
60 #endif//DMGpuSupport_DEFINED
OLDNEW
« no previous file with comments | « dm/DMGpuGMTask.cpp ('k') | dm/DMTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698