Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
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/. */
6 #include "WebGLContext.h"
7 #include "WebGLBuffer.h"
8 #include "WebGLVertexArray.h"
9 #include "WebGLExtensions.h"
10 #include "mozilla/dom/WebGLRenderingContextBinding.h"
11 #include "GLContext.h"
13 using namespace mozilla;
15 WebGLExtensionVertexArray::WebGLExtensionVertexArray(WebGLContext* context)
16 : WebGLExtensionBase(context)
17 {
18 MOZ_ASSERT(IsSupported(context), "should not construct WebGLExtensionVertexArray :"
19 "OES_vertex_array_object unsuported.");
20 }
22 WebGLExtensionVertexArray::~WebGLExtensionVertexArray()
23 {
24 }
26 already_AddRefed<WebGLVertexArray> WebGLExtensionVertexArray::CreateVertexArrayOES()
27 {
28 if (mIsLost) {
29 mContext->ErrorInvalidOperation("createVertexArrayOES: Extension is lost. Returning NULL.");
30 return nullptr;
31 }
33 return mContext->CreateVertexArray();
34 }
36 void WebGLExtensionVertexArray::DeleteVertexArrayOES(WebGLVertexArray* array)
37 {
38 if (mIsLost)
39 return mContext->ErrorInvalidOperation("deleteVertexArrayOES: Extension is lost.");
41 mContext->DeleteVertexArray(array);
42 }
44 bool WebGLExtensionVertexArray::IsVertexArrayOES(WebGLVertexArray* array)
45 {
46 if (mIsLost) {
47 mContext->ErrorInvalidOperation("isVertexArrayOES: Extension is lost. Returning false.");
48 return false;
49 }
51 return mContext->IsVertexArray(array);
52 }
54 void WebGLExtensionVertexArray::BindVertexArrayOES(WebGLVertexArray* array)
55 {
56 if (mIsLost)
57 return mContext->ErrorInvalidOperation("bindVertexArrayOES: Extension is lost.");
59 mContext->BindVertexArray(array);
60 }
62 bool WebGLExtensionVertexArray::IsSupported(const WebGLContext* context)
63 {
64 gl::GLContext* gl = context->GL();
66 return gl->IsSupported(gl::GLFeature::vertex_array_object);
67 }
69 IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionVertexArray)