| 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, | |
| 30 GrGLStandard gpuAPI, | 29 GrGLStandard gpuAPI, |
| 31 SkImageInfo info, | 30 SkImageInfo info, |
| 32 int samples, | 31 int samples, |
| 33 bool useDIText) { | 32 bool useDIText) { |
| 34 uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag
: 0; | 33 uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag
: 0; |
| 35 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 34 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
| 36 return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI, options), SkS
urface::kNo_Budgeted, | 35 return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI), SkSurface::k
No_Budgeted, |
| 37 info, samples, &props); | 36 info, samples, &props); |
| 38 } | 37 } |
| 39 | 38 |
| 40 } // namespace DM | 39 } // namespace DM |
| 41 | 40 |
| 42 #else// !SK_SUPPORT_GPU | 41 #else// !SK_SUPPORT_GPU |
| 43 | 42 |
| 44 // Ganesh is not available. Fake it. | 43 // Ganesh is not available. Fake it. |
| 45 | 44 |
| 46 enum GrGLStandard { | 45 enum GrGLStandard { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 70 | 69 |
| 71 static const GLContextType kANGLE_GLContextType = 0, | 70 static const GLContextType kANGLE_GLContextType = 0, |
| 72 kANGLE_GL_GLContextType = 0, | 71 kANGLE_GL_GLContextType = 0, |
| 73 kCommandBuffer_GLContextType = 0, | 72 kCommandBuffer_GLContextType = 0, |
| 74 kDebug_GLContextType = 0, | 73 kDebug_GLContextType = 0, |
| 75 kMESA_GLContextType = 0, | 74 kMESA_GLContextType = 0, |
| 76 kNVPR_GLContextType = 0, | 75 kNVPR_GLContextType = 0, |
| 77 kNative_GLContextType = 0, | 76 kNative_GLContextType = 0, |
| 78 kNull_GLContextType = 0; | 77 kNull_GLContextType = 0; |
| 79 static const int kGLContextTypeCnt = 1; | 78 static const int kGLContextTypeCnt = 1; |
| 80 enum GLContextOptions { | |
| 81 kNone_GLContextOptions = 0, | |
| 82 kEnableNVPR_GLContextOptions = 0x1, | |
| 83 }; | |
| 84 void destroyContexts() {} | 79 void destroyContexts() {} |
| 85 | 80 |
| 86 void abandonContexts() {} | 81 void abandonContexts() {} |
| 87 }; | 82 }; |
| 88 | 83 |
| 89 namespace DM { | 84 namespace DM { |
| 90 | 85 |
| 91 static const bool kGPUDisabled = true; | 86 static const bool kGPUDisabled = true; |
| 92 | 87 |
| 93 static inline SkSurface* NewGpuSurface(GrContextFactory*, | 88 static inline SkSurface* NewGpuSurface(GrContextFactory*, |
| 94 GrContextFactory::GLContextType, | 89 GrContextFactory::GLContextType, |
| 95 GrContextFactory::GLContextOptions, | |
| 96 GrGLStandard, | 90 GrGLStandard, |
| 97 SkImageInfo, | 91 SkImageInfo, |
| 98 int, | 92 int, |
| 99 bool) { | 93 bool) { |
| 100 return nullptr; | 94 return nullptr; |
| 101 } | 95 } |
| 102 | 96 |
| 103 } // namespace DM | 97 } // namespace DM |
| 104 | 98 |
| 105 #endif//SK_SUPPORT_GPU | 99 #endif//SK_SUPPORT_GPU |
| 106 | 100 |
| 107 #endif//DMGpuSupport_DEFINED | 101 #endif//DMGpuSupport_DEFINED |
| OLD | NEW |