OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrGpuFactory.h" | 10 #include "GrGpuFactory.h" |
11 | 11 |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
13 #include "gl/GrGLConfig.h" | 13 #include "gl/GrGLConfig.h" |
14 #include "gl/GrGLGpu.h" | 14 #include "gl/GrGLGpu.h" |
15 | 15 |
16 static CreateGpuProc gGpuFactories[kBackendCount] = { GrGLGpu::Create, NULL }; | 16 static CreateGpuProc gGpuFactories[kBackendCount] = { GrGLGpu::Create, nullptr }
; |
17 | 17 |
18 #ifdef SK_VULKAN | 18 #ifdef SK_VULKAN |
19 extern GrGpu* vk_gpu_create(GrBackendContext backendContext, const GrContextOpti
ons& options, | 19 extern GrGpu* vk_gpu_create(GrBackendContext backendContext, const GrContextOpti
ons& options, |
20 GrContext* context); | 20 GrContext* context); |
21 GrGpuFactoryRegistrar gVkGpuFactoryProc(kVulkan_GrBackend, vk_gpu_create); | 21 GrGpuFactoryRegistrar gVkGpuFactoryProc(kVulkan_GrBackend, vk_gpu_create); |
22 #endif | 22 #endif |
23 | 23 |
24 GrGpuFactoryRegistrar::GrGpuFactoryRegistrar(int i, CreateGpuProc proc) { | 24 GrGpuFactoryRegistrar::GrGpuFactoryRegistrar(int i, CreateGpuProc proc) { |
25 gGpuFactories[i] = proc; | 25 gGpuFactories[i] = proc; |
26 } | 26 } |
27 | 27 |
28 GrGpu* GrGpu::Create(GrBackend backend, | 28 GrGpu* GrGpu::Create(GrBackend backend, |
29 GrBackendContext backendContext, | 29 GrBackendContext backendContext, |
30 const GrContextOptions& options, | 30 const GrContextOptions& options, |
31 GrContext* context) { | 31 GrContext* context) { |
32 SkASSERT((int)backend < kBackendCount); | 32 SkASSERT((int)backend < kBackendCount); |
33 if (!gGpuFactories[backend]) { | 33 if (!gGpuFactories[backend]) { |
34 return NULL; | 34 return nullptr; |
35 } | 35 } |
36 return (gGpuFactories[backend])(backendContext, options, context); | 36 return (gGpuFactories[backend])(backendContext, options, context); |
37 } | 37 } |
OLD | NEW |