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, |
22 SkImageInfo info, | 23 SkImageInfo info, |
23 int samples) { | 24 int samples) { |
24 return SkSurface::NewRenderTarget(grFactory->get(type), info, samples); | 25 return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI), info, sample
s); |
25 } | 26 } |
26 | 27 |
27 } // namespace DM | 28 } // namespace DM |
28 | 29 |
29 #else// !SK_SUPPORT_GPU | 30 #else// !SK_SUPPORT_GPU |
30 | 31 |
31 // Ganesh is not available. Fake it. | 32 // Ganesh is not available. Fake it. |
32 | 33 |
| 34 enum GrGLStandard { |
| 35 kNone_GrGLStandard, |
| 36 kGL_GrGLStandard, |
| 37 kGLES_GrGLStandard |
| 38 }; |
| 39 |
33 class GrContextFactory { | 40 class GrContextFactory { |
34 public: | 41 public: |
35 typedef int GLContextType; | 42 typedef int GLContextType; |
36 | 43 |
37 static const GLContextType kANGLE_GLContextType = 0, | 44 static const GLContextType kANGLE_GLContextType = 0, |
38 kDebug_GLContextType = 0, | 45 kDebug_GLContextType = 0, |
39 kMESA_GLContextType = 0, | 46 kMESA_GLContextType = 0, |
40 kNVPR_GLContextType = 0, | 47 kNVPR_GLContextType = 0, |
41 kNative_GLContextType = 0, | 48 kNative_GLContextType = 0, |
42 kNull_GLContextType = 0; | 49 kNull_GLContextType = 0; |
43 }; | 50 }; |
44 | 51 |
45 namespace DM { | 52 namespace DM { |
46 | 53 |
47 static const bool kGPUDisabled = true; | 54 static const bool kGPUDisabled = true; |
48 | 55 |
49 static inline SkSurface* NewGpuSurface(GrContextFactory*, | 56 static inline SkSurface* NewGpuSurface(GrContextFactory*, |
50 GrContextFactory::GLContextType, | 57 GrContextFactory::GLContextType, |
| 58 GrGLStandard, |
51 SkImageInfo, | 59 SkImageInfo, |
52 int) { | 60 int) { |
53 return NULL; | 61 return NULL; |
54 } | 62 } |
55 | 63 |
56 } // namespace DM | 64 } // namespace DM |
57 | 65 |
58 #endif//SK_SUPPORT_GPU | 66 #endif//SK_SUPPORT_GPU |
59 | 67 |
60 #endif//DMGpuSupport_DEFINED | 68 #endif//DMGpuSupport_DEFINED |
OLD | NEW |