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: 4; 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 #ifndef WEBGLVERTEXARRAY_H_
7 #define WEBGLVERTEXARRAY_H_
9 #include "WebGLObjectModel.h"
10 #include "WebGLBuffer.h"
11 #include "WebGLVertexAttribData.h"
13 #include "nsWrapperCache.h"
15 #include "mozilla/LinkedList.h"
17 namespace mozilla {
19 class WebGLVertexArray MOZ_FINAL
20 : public nsWrapperCache
21 , public WebGLRefCountedObject<WebGLVertexArray>
22 , public LinkedListElement<WebGLVertexArray>
23 , public WebGLContextBoundObject
24 {
25 // -----------------------------------------------------------------------------
26 // PUBLIC
27 public:
29 // -------------------------------------------------------------------------
30 // CONSTRUCTOR & DESTRUCTOR
32 WebGLVertexArray(WebGLContext *context);
34 ~WebGLVertexArray() {
35 DeleteOnce();
36 };
39 // -------------------------------------------------------------------------
40 // IMPLMENET PARENT CLASSES
42 void Delete();
44 WebGLContext* GetParentObject() const {
45 return Context();
46 }
48 virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
50 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLVertexArray)
51 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLVertexArray)
54 // -------------------------------------------------------------------------
55 // MEMBER FUNCTIONS
57 bool HasEverBeenBound() { return mHasEverBeenBound; }
58 void SetHasEverBeenBound(bool x) { mHasEverBeenBound = x; }
59 GLuint GLName() const { return mGLName; }
61 bool EnsureAttrib(GLuint index, const char *info);
62 bool HasAttrib(GLuint index) {
63 return index < mAttribs.Length();
64 }
65 bool IsAttribArrayEnabled(GLuint index) {
66 return HasAttrib(index) && mAttribs[index].enabled;
67 }
70 // -----------------------------------------------------------------------------
71 // PRIVATE
72 private:
74 // -------------------------------------------------------------------------
75 // MEMBERS
77 GLuint mGLName;
78 bool mHasEverBeenBound;
79 nsTArray<WebGLVertexAttribData> mAttribs;
80 WebGLRefPtr<WebGLBuffer> mBoundElementArrayBuffer;
83 // -------------------------------------------------------------------------
84 // FRIENDSHIPS
86 friend class WebGLContext;
87 };
89 } // namespace mozilla
91 #endif