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.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "WebGLContext.h" |
michael@0 | 7 | #include "WebGLBuffer.h" |
michael@0 | 8 | #include "WebGLVertexArray.h" |
michael@0 | 9 | #include "WebGLExtensions.h" |
michael@0 | 10 | #include "mozilla/dom/WebGLRenderingContextBinding.h" |
michael@0 | 11 | #include "GLContext.h" |
michael@0 | 12 | |
michael@0 | 13 | using namespace mozilla; |
michael@0 | 14 | |
michael@0 | 15 | WebGLExtensionVertexArray::WebGLExtensionVertexArray(WebGLContext* context) |
michael@0 | 16 | : WebGLExtensionBase(context) |
michael@0 | 17 | { |
michael@0 | 18 | MOZ_ASSERT(IsSupported(context), "should not construct WebGLExtensionVertexArray :" |
michael@0 | 19 | "OES_vertex_array_object unsuported."); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | WebGLExtensionVertexArray::~WebGLExtensionVertexArray() |
michael@0 | 23 | { |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | already_AddRefed<WebGLVertexArray> WebGLExtensionVertexArray::CreateVertexArrayOES() |
michael@0 | 27 | { |
michael@0 | 28 | if (mIsLost) { |
michael@0 | 29 | mContext->ErrorInvalidOperation("createVertexArrayOES: Extension is lost. Returning NULL."); |
michael@0 | 30 | return nullptr; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | return mContext->CreateVertexArray(); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | void WebGLExtensionVertexArray::DeleteVertexArrayOES(WebGLVertexArray* array) |
michael@0 | 37 | { |
michael@0 | 38 | if (mIsLost) |
michael@0 | 39 | return mContext->ErrorInvalidOperation("deleteVertexArrayOES: Extension is lost."); |
michael@0 | 40 | |
michael@0 | 41 | mContext->DeleteVertexArray(array); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | bool WebGLExtensionVertexArray::IsVertexArrayOES(WebGLVertexArray* array) |
michael@0 | 45 | { |
michael@0 | 46 | if (mIsLost) { |
michael@0 | 47 | mContext->ErrorInvalidOperation("isVertexArrayOES: Extension is lost. Returning false."); |
michael@0 | 48 | return false; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | return mContext->IsVertexArray(array); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | void WebGLExtensionVertexArray::BindVertexArrayOES(WebGLVertexArray* array) |
michael@0 | 55 | { |
michael@0 | 56 | if (mIsLost) |
michael@0 | 57 | return mContext->ErrorInvalidOperation("bindVertexArrayOES: Extension is lost."); |
michael@0 | 58 | |
michael@0 | 59 | mContext->BindVertexArray(array); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | bool WebGLExtensionVertexArray::IsSupported(const WebGLContext* context) |
michael@0 | 63 | { |
michael@0 | 64 | gl::GLContext* gl = context->GL(); |
michael@0 | 65 | |
michael@0 | 66 | return gl->IsSupported(gl::GLFeature::vertex_array_object); |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionVertexArray) |