gfx/skia/trunk/src/gpu/gl/GrGLContext.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.

     1 /*
     2  * Copyright 2013 Google Inc.
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     8 #include "GrGLContext.h"
    10 ////////////////////////////////////////////////////////////////////////////////
    12 GrGLContextInfo& GrGLContextInfo::operator= (const GrGLContextInfo& that) {
    13     fInterface.reset(SkSafeRef(that.fInterface.get()));
    14     fGLVersion      = that.fGLVersion;
    15     fGLSLGeneration = that.fGLSLGeneration;
    16     fVendor         = that.fVendor;
    17     fRenderer       = that.fRenderer;
    18     fIsMesa         = that.fIsMesa;
    19     fIsChromium     = that.fIsChromium;
    20     *fGLCaps        = *that.fGLCaps.get();
    21     return *this;
    22 }
    24 bool GrGLContextInfo::initialize(const GrGLInterface* interface) {
    25     this->reset();
    26     // We haven't validated the GrGLInterface yet, so check for GetString
    27     // function pointer
    28     if (interface->fFunctions.fGetString) {
    29         const GrGLubyte* verUByte;
    30         GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION));
    31         const char* ver = reinterpret_cast<const char*>(verUByte);
    33         const GrGLubyte* rendererUByte;
    34         GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER));
    35         const char* renderer = reinterpret_cast<const char*>(rendererUByte);
    37         if (interface->validate()) {
    39             fGLVersion = GrGLGetVersionFromString(ver);
    41             fGLSLGeneration = GrGetGLSLGeneration(interface);
    43             fVendor = GrGLGetVendor(interface);
    45             fRenderer = GrGLGetRendererFromString(renderer);
    47             fIsMesa = GrGLIsMesaFromVersionString(ver);
    49             fIsChromium = GrGLIsChromiumFromRendererString(renderer);
    51             // This must occur before caps init.
    52             fInterface.reset(SkRef(interface));
    54             fGLCaps->init(*this, interface);
    56             return true;
    57         }
    58     }
    59     return false;
    60 }
    62 bool GrGLContextInfo::isInitialized() const {
    63     return NULL != fInterface.get();
    64 }
    66 void GrGLContextInfo::reset() {
    67     fInterface.reset(NULL);
    68     fGLVersion = GR_GL_VER(0, 0);
    69     fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
    70     fVendor = kOther_GrGLVendor;
    71     fRenderer = kOther_GrGLRenderer;
    72     fIsMesa = false;
    73     fIsChromium = false;
    74     fGLCaps->reset();
    75 }

mercurial