content/canvas/src/WebGLVertexArray.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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

mercurial