| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // Ganesh is available. Yippee! | 22 // Ganesh is available. Yippee! |
| 23 | 23 |
| 24 # include "GrContext.h" | 24 # include "GrContext.h" |
| 25 # include "GrContextFactory.h" | 25 # include "GrContextFactory.h" |
| 26 | 26 |
| 27 namespace DM { | 27 namespace DM { |
| 28 | 28 |
| 29 static const bool kGPUDisabled = false; | 29 static const bool kGPUDisabled = false; |
| 30 | 30 |
| 31 static inline sk_sp<SkSurface> NewGpuSurface( | 31 static inline sk_sp<SkSurface> NewGpuSurface(GrContextFactory* grFactory, |
| 32 sk_gpu_test::GrContextFactory* grFactory, | 32 GrContextFactory::GLContextType typ
e, |
| 33 sk_gpu_test::GrContextFactory::GLContextType type, | 33 GrContextFactory::GLContextOptions
options, |
| 34 sk_gpu_test::GrContextFactory::GLContextOptions options, | 34 SkImageInfo info, |
| 35 SkImageInfo info, | 35 int samples, |
| 36 int samples, | 36 bool useDIText) { |
| 37 bool useDIText) { | |
| 38 uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag
: 0; | 37 uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag
: 0; |
| 39 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 38 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
| 40 return SkSurface::MakeRenderTarget(grFactory->get(type, options), SkBudgeted
::kNo, | 39 return SkSurface::MakeRenderTarget(grFactory->get(type, options), SkBudgeted
::kNo, |
| 41 info, samples, &props); | 40 info, samples, &props); |
| 42 } | 41 } |
| 43 | 42 |
| 44 } // namespace DM | 43 } // namespace DM |
| 45 | 44 |
| 46 #else// !SK_SUPPORT_GPU | 45 #else// !SK_SUPPORT_GPU |
| 47 | 46 |
| 48 // Ganesh is not available. Fake it. | 47 // Ganesh is not available. Fake it. |
| 49 | 48 |
| 50 enum GrGLStandard { | 49 enum GrGLStandard { |
| 51 kNone_GrGLStandard, | 50 kNone_GrGLStandard, |
| 52 kGL_GrGLStandard, | 51 kGL_GrGLStandard, |
| 53 kGLES_GrGLStandard | 52 kGLES_GrGLStandard |
| 54 }; | 53 }; |
| 55 static const int kGrGLStandardCnt = 3; | 54 static const int kGrGLStandardCnt = 3; |
| 56 | 55 |
| 57 class GrContext { | 56 class GrContext { |
| 58 public: | 57 public: |
| 59 void dumpCacheStats(SkString*) const {} | 58 void dumpCacheStats(SkString*) const {} |
| 60 void dumpGpuStats(SkString*) const {} | 59 void dumpGpuStats(SkString*) const {} |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 namespace sk_gpu_test { | |
| 64 class GrContextFactory { | 62 class GrContextFactory { |
| 65 public: | 63 public: |
| 66 GrContextFactory() {}; | 64 GrContextFactory() {}; |
| 67 explicit GrContextFactory(const GrContextOptions&) {} | 65 explicit GrContextFactory(const GrContextOptions&) {} |
| 68 | 66 |
| 69 typedef int GLContextType; | 67 typedef int GLContextType; |
| 70 | 68 |
| 71 static const GLContextType kANGLE_GLContextType = 0, | 69 static const GLContextType kANGLE_GLContextType = 0, |
| 72 kANGLE_GL_GLContextType = 0, | 70 kANGLE_GL_GLContextType = 0, |
| 73 kCommandBuffer_GLContextType = 0, | 71 kCommandBuffer_GLContextType = 0, |
| 74 kDebug_GLContextType = 0, | 72 kDebug_GLContextType = 0, |
| 75 kMESA_GLContextType = 0, | 73 kMESA_GLContextType = 0, |
| 76 kNVPR_GLContextType = 0, | 74 kNVPR_GLContextType = 0, |
| 77 kNative_GLContextType = 0, | 75 kNative_GLContextType = 0, |
| 78 kNull_GLContextType = 0; | 76 kNull_GLContextType = 0; |
| 79 static const int kGLContextTypeCnt = 1; | 77 static const int kGLContextTypeCnt = 1; |
| 80 enum GLContextOptions { | 78 enum GLContextOptions { |
| 81 kNone_GLContextOptions = 0, | 79 kNone_GLContextOptions = 0, |
| 82 kEnableNVPR_GLContextOptions = 0x1, | 80 kEnableNVPR_GLContextOptions = 0x1, |
| 83 }; | 81 }; |
| 84 void destroyContexts() {} | 82 void destroyContexts() {} |
| 85 | 83 |
| 86 void abandonContexts() {} | 84 void abandonContexts() {} |
| 87 }; | 85 }; |
| 88 } // namespace sk_gpu_test | |
| 89 | 86 |
| 90 namespace DM { | 87 namespace DM { |
| 91 | 88 |
| 92 static const bool kGPUDisabled = true; | 89 static const bool kGPUDisabled = true; |
| 93 | 90 |
| 94 static inline SkSurface* NewGpuSurface(sk_gpu_test::GrContextFactory*, | 91 static inline SkSurface* NewGpuSurface(GrContextFactory*, |
| 95 sk_gpu_test::GrContextFactory::GLContextT
ype, | 92 GrContextFactory::GLContextType, |
| 96 sk_gpu_test::GrContextFactory::GLContextO
ptions, | 93 GrContextFactory::GLContextOptions, |
| 97 SkImageInfo, | 94 SkImageInfo, |
| 98 int, | 95 int, |
| 99 bool) { | 96 bool) { |
| 100 return nullptr; | 97 return nullptr; |
| 101 } | 98 } |
| 102 | 99 |
| 103 } // namespace DM | 100 } // namespace DM |
| 104 | 101 |
| 105 #endif//SK_SUPPORT_GPU | 102 #endif//SK_SUPPORT_GPU |
| 106 | 103 |
| 107 #endif//DMGpuSupport_DEFINED | 104 #endif//DMGpuSupport_DEFINED |
| OLD | NEW |