Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / canvas / WebGLRenderbuffer.h
blob46aabe2ebec4cfbb636d31b55bf37dd5177f02ea
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 WEBGLRENDERBUFFER_H_
7 #define WEBGLRENDERBUFFER_H_
9 #include "WebGLBindableName.h"
10 #include "WebGLObjectModel.h"
11 #include "WebGLFramebufferAttachable.h"
13 #include "nsWrapperCache.h"
15 #include "mozilla/LinkedList.h"
17 namespace mozilla {
19 class WebGLRenderbuffer MOZ_FINAL
20 : public nsWrapperCache
21 , public WebGLBindableName
22 , public WebGLRefCountedObject<WebGLRenderbuffer>
23 , public LinkedListElement<WebGLRenderbuffer>
24 , public WebGLRectangleObject
25 , public WebGLContextBoundObject
26 , public WebGLFramebufferAttachable
28 public:
29 explicit WebGLRenderbuffer(WebGLContext* context);
31 void Delete();
33 bool HasUninitializedImageData() const { return mImageDataStatus == WebGLImageDataStatus::UninitializedImageData; }
34 void SetImageDataStatus(WebGLImageDataStatus x) {
35 // there is no way to go from having image data to not having any
36 MOZ_ASSERT(x != WebGLImageDataStatus::NoImageData ||
37 mImageDataStatus == WebGLImageDataStatus::NoImageData);
38 mImageDataStatus = x;
41 GLenum InternalFormat() const { return mInternalFormat; }
42 void SetInternalFormat(GLenum aInternalFormat) { mInternalFormat = aInternalFormat; }
44 GLenum InternalFormatForGL() const { return mInternalFormatForGL; }
45 void SetInternalFormatForGL(GLenum aInternalFormatForGL) { mInternalFormatForGL = aInternalFormatForGL; }
47 int64_t MemoryUsage() const;
49 WebGLContext *GetParentObject() const {
50 return Context();
53 void BindRenderbuffer() const;
54 void RenderbufferStorage(GLenum internalFormat, GLsizei width, GLsizei height) const;
55 void FramebufferRenderbuffer(GLenum attachment) const;
56 // Only handles a subset of `pname`s.
57 GLint GetRenderbufferParameter(GLenum target, GLenum pname) const;
59 virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
61 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLRenderbuffer)
62 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLRenderbuffer)
64 protected:
65 ~WebGLRenderbuffer() {
66 DeleteOnce();
69 GLuint mPrimaryRB;
70 GLuint mSecondaryRB;
71 GLenum mInternalFormat;
72 GLenum mInternalFormatForGL;
73 WebGLImageDataStatus mImageDataStatus;
75 friend class WebGLFramebuffer;
77 } // namespace mozilla
79 #endif