OLD | NEW |
1 #ifndef DMGpuSupport_DEFINED | 1 #ifndef DMGpuSupport_DEFINED |
2 #define DMGpuSupport_DEFINED | 2 #define DMGpuSupport_DEFINED |
3 | 3 |
4 // Provides Ganesh to DM, | 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. | 5 // or if it's not available, fakes it enough so most code doesn't have to know t
hat. |
6 | 6 |
7 #include "SkSurface.h" | 7 #include "SkSurface.h" |
8 | 8 |
9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 | 10 |
11 // Ganesh is available. Yippee! | 11 // Ganesh is available. Yippee! |
12 | 12 |
13 # include "GrContext.h" | 13 # include "GrContext.h" |
14 # include "GrContextFactory.h" | 14 # include "GrContextFactory.h" |
15 | 15 |
16 namespace DM { | 16 namespace DM { |
17 | 17 |
18 static const bool kGPUDisabled = false; | 18 static const bool kGPUDisabled = false; |
19 | 19 |
20 static inline SkSurface* NewGpuSurface(GrContextFactory* grFactory, | 20 static inline SkSurface* NewGpuSurface(GrContextFactory* grFactory, |
21 GrContextFactory::GLContextType type, | 21 GrContextFactory::GLContextType type, |
22 GrGLStandard gpuAPI, | |
23 SkImageInfo info, | 22 SkImageInfo info, |
24 int samples) { | 23 int samples) { |
25 return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI), info, sample
s); | 24 return SkSurface::NewRenderTarget(grFactory->get(type), info, samples); |
26 } | 25 } |
27 | 26 |
28 } // namespace DM | 27 } // namespace DM |
29 | 28 |
30 #else// !SK_SUPPORT_GPU | 29 #else// !SK_SUPPORT_GPU |
31 | 30 |
32 // Ganesh is not available. Fake it. | 31 // Ganesh is not available. Fake it. |
33 | 32 |
34 enum GrGLStandard { | |
35 kNone_GrGLStandard, | |
36 kGL_GrGLStandard, | |
37 kGLES_GrGLStandard | |
38 }; | |
39 | |
40 class GrContextFactory { | 33 class GrContextFactory { |
41 public: | 34 public: |
42 typedef int GLContextType; | 35 typedef int GLContextType; |
43 | 36 |
44 static const GLContextType kANGLE_GLContextType = 0, | 37 static const GLContextType kANGLE_GLContextType = 0, |
45 kDebug_GLContextType = 0, | 38 kDebug_GLContextType = 0, |
46 kMESA_GLContextType = 0, | 39 kMESA_GLContextType = 0, |
47 kNVPR_GLContextType = 0, | 40 kNVPR_GLContextType = 0, |
48 kNative_GLContextType = 0, | 41 kNative_GLContextType = 0, |
49 kNull_GLContextType = 0; | 42 kNull_GLContextType = 0; |
50 }; | 43 }; |
51 | 44 |
52 namespace DM { | 45 namespace DM { |
53 | 46 |
54 static const bool kGPUDisabled = true; | 47 static const bool kGPUDisabled = true; |
55 | 48 |
56 static inline SkSurface* NewGpuSurface(GrContextFactory*, | 49 static inline SkSurface* NewGpuSurface(GrContextFactory*, |
57 GrContextFactory::GLContextType, | 50 GrContextFactory::GLContextType, |
58 GrGLStandard, | |
59 SkImageInfo, | 51 SkImageInfo, |
60 int) { | 52 int) { |
61 return NULL; | 53 return NULL; |
62 } | 54 } |
63 | 55 |
64 } // namespace DM | 56 } // namespace DM |
65 | 57 |
66 #endif//SK_SUPPORT_GPU | 58 #endif//SK_SUPPORT_GPU |
67 | 59 |
68 #endif//DMGpuSupport_DEFINED | 60 #endif//DMGpuSupport_DEFINED |
OLD | NEW |