LCOV - code coverage report
Current view: top level - widget - GfxInfoWebGL.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 31 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* vim: se cin sw=2 ts=2 et : */
       2             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       7             : 
       8             : #include "GfxInfoWebGL.h"
       9             : 
      10             : #include "nsServiceManagerUtils.h"
      11             : 
      12             : #include "GLDefs.h"
      13             : #include "nsIDOMWebGLRenderingContext.h"
      14             : #include "nsICanvasRenderingContextInternal.h"
      15             : 
      16             : using namespace mozilla::widget;
      17             : 
      18             : nsresult
      19           0 : GfxInfoWebGL::GetWebGLParameter(const nsAString& aParam, nsAString& aResult)
      20             : {
      21             :   GLenum param;
      22             : 
      23           0 :   if (aParam.EqualsLiteral("vendor")) param = LOCAL_GL_VENDOR;
      24           0 :   else if (aParam.EqualsLiteral("renderer")) param = LOCAL_GL_RENDERER;
      25           0 :   else if (aParam.EqualsLiteral("version")) param = LOCAL_GL_VERSION;
      26           0 :   else if (aParam.EqualsLiteral("shading_language_version")) param = LOCAL_GL_SHADING_LANGUAGE_VERSION;
      27           0 :   else if (aParam.EqualsLiteral("extensions")) param = LOCAL_GL_EXTENSIONS;
      28           0 :   else if (aParam.EqualsLiteral("full-renderer")) param = 0;
      29           0 :   else return NS_ERROR_INVALID_ARG;
      30             : 
      31             :   nsCOMPtr<nsIDOMWebGLRenderingContext> webgl =
      32           0 :     do_CreateInstance("@mozilla.org/content/canvas-rendering-context;1?id=webgl");
      33           0 :   if (!webgl)
      34           0 :     return NS_ERROR_NOT_AVAILABLE;
      35             : 
      36             :   nsCOMPtr<nsICanvasRenderingContextInternal> webglInternal =
      37           0 :     do_QueryInterface(webgl);
      38           0 :   if (!webglInternal)
      39           0 :     return NS_ERROR_NOT_AVAILABLE;
      40             : 
      41           0 :   nsresult rv = webglInternal->SetDimensions(16, 16);
      42           0 :   NS_ENSURE_SUCCESS(rv, rv);
      43             : 
      44           0 :   if (param)
      45           0 :     return webgl->MozGetUnderlyingParamString(param, aResult);
      46             : 
      47             :   // this is the "full renderer" string, which is vendor + renderer + version
      48             : 
      49           0 :   nsAutoString str;
      50             : 
      51           0 :   rv = webgl->MozGetUnderlyingParamString(LOCAL_GL_VENDOR, str);
      52           0 :   NS_ENSURE_SUCCESS(rv, rv);
      53             : 
      54           0 :   aResult.Append(str);
      55           0 :   aResult.AppendLiteral(" -- ");
      56             : 
      57           0 :   rv = webgl->MozGetUnderlyingParamString(LOCAL_GL_RENDERER, str);
      58           0 :   NS_ENSURE_SUCCESS(rv, rv);
      59             : 
      60           0 :   aResult.Append(str);
      61           0 :   aResult.AppendLiteral(" -- ");
      62             : 
      63           0 :   rv = webgl->MozGetUnderlyingParamString(LOCAL_GL_VERSION, str);
      64           0 :   NS_ENSURE_SUCCESS(rv, rv);
      65             : 
      66           0 :   aResult.Append(str);
      67             : 
      68           0 :   return NS_OK;
      69             : }

Generated by: LCOV version 1.13