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