| 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 GrContextFactory::GLContextOptions option
s, |
| 30 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, options), SkSurface::
kNo_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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 void abandonContexts() {} | 85 void abandonContexts() {} |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 namespace DM { | 88 namespace DM { |
| 90 | 89 |
| 91 static const bool kGPUDisabled = true; | 90 static const bool kGPUDisabled = true; |
| 92 | 91 |
| 93 static inline SkSurface* NewGpuSurface(GrContextFactory*, | 92 static inline SkSurface* NewGpuSurface(GrContextFactory*, |
| 94 GrContextFactory::GLContextType, | 93 GrContextFactory::GLContextType, |
| 95 GrContextFactory::GLContextOptions, | 94 GrContextFactory::GLContextOptions, |
| 96 GrGLStandard, | |
| 97 SkImageInfo, | 95 SkImageInfo, |
| 98 int, | 96 int, |
| 99 bool) { | 97 bool) { |
| 100 return nullptr; | 98 return nullptr; |
| 101 } | 99 } |
| 102 | 100 |
| 103 } // namespace DM | 101 } // namespace DM |
| 104 | 102 |
| 105 #endif//SK_SUPPORT_GPU | 103 #endif//SK_SUPPORT_GPU |
| 106 | 104 |
| 107 #endif//DMGpuSupport_DEFINED | 105 #endif//DMGpuSupport_DEFINED |
| OLD | NEW |