Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "WebGL1Context.h"
7 :
8 : #include "mozilla/dom/WebGLRenderingContextBinding.h"
9 : #include "mozilla/Telemetry.h"
10 : #include "WebGLFormats.h"
11 :
12 : namespace mozilla {
13 :
14 : /*static*/ WebGL1Context*
15 0 : WebGL1Context::Create()
16 : {
17 0 : return new WebGL1Context();
18 : }
19 :
20 0 : WebGL1Context::WebGL1Context()
21 0 : : WebGLContext()
22 : {
23 0 : }
24 :
25 0 : WebGL1Context::~WebGL1Context()
26 : {
27 0 : }
28 :
29 : UniquePtr<webgl::FormatUsageAuthority>
30 0 : WebGL1Context::CreateFormatUsage(gl::GLContext* gl) const
31 : {
32 0 : return webgl::FormatUsageAuthority::CreateForWebGL1(gl);
33 : }
34 :
35 : JSObject*
36 0 : WebGL1Context::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
37 : {
38 0 : return dom::WebGLRenderingContextBinding::Wrap(cx, this, givenProto);
39 : }
40 :
41 : } // namespace mozilla
42 :
43 : nsresult
44 0 : NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** out_result)
45 : {
46 0 : mozilla::Telemetry::Accumulate(mozilla::Telemetry::CANVAS_WEBGL_USED, 1);
47 :
48 0 : nsIDOMWebGLRenderingContext* ctx = mozilla::WebGL1Context::Create();
49 :
50 0 : NS_ADDREF(*out_result = ctx);
51 0 : return NS_OK;
52 : }
|