gfx/skia/trunk/src/gpu/GrGpuFactory.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     2 /*
     3  * Copyright 2011 Google Inc.
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #include "GrTypes.h"
    12 #include "gl/GrGLConfig.h"
    14 #include "GrGpu.h"
    15 #include "gl/GrGpuGL.h"
    17 GrGpu* GrGpu::Create(GrBackend backend, GrBackendContext backendContext, GrContext* context) {
    19     const GrGLInterface* glInterface = NULL;
    20     SkAutoTUnref<const GrGLInterface> glInterfaceUnref;
    22     if (kOpenGL_GrBackend == backend) {
    23         glInterface = reinterpret_cast<const GrGLInterface*>(backendContext);
    24         if (NULL == glInterface) {
    25             glInterface = GrGLDefaultInterface();
    26             // By calling GrGLDefaultInterface we've taken a ref on the
    27             // returned object. We only want to hold that ref until after
    28             // the GrGpu is constructed and has taken ownership.
    29             glInterfaceUnref.reset(glInterface);
    30         }
    31         if (NULL == glInterface) {
    32 #ifdef SK_DEBUG
    33             GrPrintf("No GL interface provided!\n");
    34 #endif
    35             return NULL;
    36         }
    37         GrGLContext ctx(glInterface);
    38         if (ctx.isInitialized()) {
    39             return SkNEW_ARGS(GrGpuGL, (ctx, context));
    40         }
    41     }
    42     return NULL;
    43 }

mercurial