| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef DMGpuSupport_DEFINED | 8 #ifndef DMGpuSupport_DEFINED |
| 9 #define DMGpuSupport_DEFINED | 9 #define DMGpuSupport_DEFINED |
| 10 | 10 |
| 11 // Provides Ganesh to DM, | 11 // Provides Ganesh to DM, |
| 12 // or if it's not available, fakes it enough so most code doesn't have to know t
hat. | 12 // or if it's not available, fakes it enough so most code doesn't have to know t
hat. |
| 13 | 13 |
| 14 #include "SkSurface.h" | 14 #include "SkSurface.h" |
| 15 | 15 |
| 16 #if SK_SUPPORT_GPU | 16 #if SK_SUPPORT_GPU |
| 17 | 17 |
| 18 // Ganesh is available. Yippee! | 18 // Ganesh is available. Yippee! |
| 19 | 19 |
| 20 # include "GrContext.h" | 20 # include "GrContext.h" |
| 21 # include "GrContextFactory.h" | 21 # include "GrContextFactory.h" |
| 22 | 22 |
| 23 namespace DM { | 23 namespace DM { |
| 24 | 24 |
| 25 static const bool kGPUDisabled = false; | 25 static const bool kGPUDisabled = false; |
| 26 | 26 |
| 27 static inline SkSurface* NewGpuSurface(GrContextFactory* grFactory, | 27 static inline SkSurface* NewGpuSurface(GrContextFactory* grFactory, |
| 28 GrContextFactory::GLContextType type, | 28 GrContextFactory::GLContextType type, |
| 29 GrContextFactory::GLContextOptions option
s, |
| 29 GrGLStandard gpuAPI, | 30 GrGLStandard gpuAPI, |
| 30 SkImageInfo info, | 31 SkImageInfo info, |
| 31 int samples, | 32 int samples, |
| 32 bool useDIText) { | 33 bool useDIText) { |
| 33 uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag
: 0; | 34 uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag
: 0; |
| 34 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 35 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
| 35 return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI), SkSurface::k
No_Budgeted, | 36 return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI, options), SkS
urface::kNo_Budgeted, |
| 36 info, samples, &props); | 37 info, samples, &props); |
| 37 } | 38 } |
| 38 | 39 |
| 39 } // namespace DM | 40 } // namespace DM |
| 40 | 41 |
| 41 #else// !SK_SUPPORT_GPU | 42 #else// !SK_SUPPORT_GPU |
| 42 | 43 |
| 43 // Ganesh is not available. Fake it. | 44 // Ganesh is not available. Fake it. |
| 44 | 45 |
| 45 enum GrGLStandard { | 46 enum GrGLStandard { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 69 | 70 |
| 70 static const GLContextType kANGLE_GLContextType = 0, | 71 static const GLContextType kANGLE_GLContextType = 0, |
| 71 kANGLE_GL_GLContextType = 0, | 72 kANGLE_GL_GLContextType = 0, |
| 72 kCommandBuffer_GLContextType = 0, | 73 kCommandBuffer_GLContextType = 0, |
| 73 kDebug_GLContextType = 0, | 74 kDebug_GLContextType = 0, |
| 74 kMESA_GLContextType = 0, | 75 kMESA_GLContextType = 0, |
| 75 kNVPR_GLContextType = 0, | 76 kNVPR_GLContextType = 0, |
| 76 kNative_GLContextType = 0, | 77 kNative_GLContextType = 0, |
| 77 kNull_GLContextType = 0; | 78 kNull_GLContextType = 0; |
| 78 static const int kGLContextTypeCnt = 1; | 79 static const int kGLContextTypeCnt = 1; |
| 80 enum GLContextOptions { |
| 81 kNone_GLContextOptions = 0, |
| 82 kEnableNVPR_GLContextOptions = 0x1, |
| 83 }; |
| 79 void destroyContexts() {} | 84 void destroyContexts() {} |
| 80 | 85 |
| 81 void abandonContexts() {} | 86 void abandonContexts() {} |
| 82 }; | 87 }; |
| 83 | 88 |
| 84 namespace DM { | 89 namespace DM { |
| 85 | 90 |
| 86 static const bool kGPUDisabled = true; | 91 static const bool kGPUDisabled = true; |
| 87 | 92 |
| 88 static inline SkSurface* NewGpuSurface(GrContextFactory*, | 93 static inline SkSurface* NewGpuSurface(GrContextFactory*, |
| 89 GrContextFactory::GLContextType, | 94 GrContextFactory::GLContextType, |
| 95 GrContextFactory::GLContextOptions, |
| 90 GrGLStandard, | 96 GrGLStandard, |
| 91 SkImageInfo, | 97 SkImageInfo, |
| 92 int, | 98 int, |
| 93 bool) { | 99 bool) { |
| 94 return nullptr; | 100 return nullptr; |
| 95 } | 101 } |
| 96 | 102 |
| 97 } // namespace DM | 103 } // namespace DM |
| 98 | 104 |
| 99 #endif//SK_SUPPORT_GPU | 105 #endif//SK_SUPPORT_GPU |
| 100 | 106 |
| 101 #endif//DMGpuSupport_DEFINED | 107 #endif//DMGpuSupport_DEFINED |
| OLD | NEW |