aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLGpu.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-12-07 12:33:05 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-07 17:56:59 +0000
commit384fab467e2a5f1754ec26eecde946ce28046d20 (patch)
treec19ad170f2932c666c937736be71237c335e79b3 /src/gpu/gl/GrGLGpu.cpp
parent1cfb6bc9b63e9840d198a1ea8b1a20da2bfde818 (diff)
sk_spification of GrGpu creation.
Make GrContext::MakeGL take interface as sk_sp. Make GrContext::MakeVulkan take GrVkBackendContext as sk_sp. Change-Id: I13c22a57bd281c51738f503d9ed3418d35a466df Reviewed-on: https://skia-review.googlesource.com/81842 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/gl/GrGLGpu.cpp')
-rw-r--r--src/gpu/gl/GrGLGpu.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 8bf6389fb6..33096160a4 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -182,29 +182,26 @@ bool GrGLGpu::BlendCoeffReferencesConstant(GrBlendCoeff coeff) {
///////////////////////////////////////////////////////////////////////////////
-
-GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions& options,
- GrContext* context) {
- return Create(reinterpret_cast<const GrGLInterface*>(backendContext), options, context);
+sk_sp<GrGpu> GrGLGpu::Make(GrBackendContext backendContext, const GrContextOptions& options,
+ GrContext* context) {
+ const auto* interface = reinterpret_cast<const GrGLInterface*>(backendContext);
+ return Make(sk_ref_sp(interface), options, context);
}
-GrGpu* GrGLGpu::Create(const GrGLInterface* interface, const GrContextOptions& options,
- GrContext* context) {
- sk_sp<const GrGLInterface> glInterface(interface);
- if (!glInterface) {
- glInterface.reset(GrGLDefaultInterface());
- } else {
- glInterface->ref();
- }
- if (!glInterface) {
- return nullptr;
+sk_sp<GrGpu> GrGLGpu::Make(sk_sp<const GrGLInterface> interface, const GrContextOptions& options,
+ GrContext* context) {
+ if (!interface) {
+ interface.reset(GrGLDefaultInterface());
+ if (!interface) {
+ return nullptr;
+ }
}
#ifdef USE_NSIGHT
const_cast<GrContextOptions&>(options).fSuppressPathRendering = true;
#endif
- GrGLContext* glContext = GrGLContext::Create(glInterface.get(), options);
+ GrGLContext* glContext = GrGLContext::Create(interface.get(), options);
if (glContext) {
- return new GrGLGpu(glContext, context);
+ return sk_sp<GrGpu>(new GrGLGpu(glContext, context));
}
return nullptr;
}