content/canvas/src/WebGLRenderbuffer.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 WEBGLRENDERBUFFER_H_
     7 #define WEBGLRENDERBUFFER_H_
     9 #include "WebGLObjectModel.h"
    10 #include "WebGLFramebufferAttachable.h"
    12 #include "nsWrapperCache.h"
    14 #include "mozilla/LinkedList.h"
    16 namespace mozilla {
    18 class WebGLRenderbuffer MOZ_FINAL
    19     : public nsWrapperCache
    20     , public WebGLRefCountedObject<WebGLRenderbuffer>
    21     , public LinkedListElement<WebGLRenderbuffer>
    22     , public WebGLRectangleObject
    23     , public WebGLContextBoundObject
    24     , public WebGLFramebufferAttachable
    25 {
    26 public:
    27     WebGLRenderbuffer(WebGLContext *context);
    29     ~WebGLRenderbuffer() {
    30         DeleteOnce();
    31     }
    33     void Delete();
    35     bool HasEverBeenBound() { return mHasEverBeenBound; }
    36     void SetHasEverBeenBound(bool x) { mHasEverBeenBound = x; }
    38     bool HasUninitializedImageData() const { return mImageDataStatus == WebGLImageDataStatus::UninitializedImageData; }
    39     void SetImageDataStatus(WebGLImageDataStatus x) {
    40         // there is no way to go from having image data to not having any
    41         MOZ_ASSERT(x != WebGLImageDataStatus::NoImageData ||
    42                    mImageDataStatus == WebGLImageDataStatus::NoImageData);
    43         mImageDataStatus = x;
    44     }
    46     GLenum InternalFormat() const { return mInternalFormat; }
    47     void SetInternalFormat(GLenum aInternalFormat) { mInternalFormat = aInternalFormat; }
    49     GLenum InternalFormatForGL() const { return mInternalFormatForGL; }
    50     void SetInternalFormatForGL(GLenum aInternalFormatForGL) { mInternalFormatForGL = aInternalFormatForGL; }
    52     int64_t MemoryUsage() const;
    54     WebGLContext *GetParentObject() const {
    55         return Context();
    56     }
    58     void BindRenderbuffer() const;
    59     void RenderbufferStorage(GLenum internalFormat, GLsizei width, GLsizei height) const;
    60     void FramebufferRenderbuffer(GLenum attachment) const;
    61     // Only handles a subset of `pname`s.
    62     GLint GetRenderbufferParameter(GLenum target, GLenum pname) const;
    64     virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
    66     NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLRenderbuffer)
    67     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLRenderbuffer)
    69 protected:
    70     GLuint mPrimaryRB;
    71     GLuint mSecondaryRB;
    72     GLenum mInternalFormat;
    73     GLenum mInternalFormatForGL;
    74     bool mHasEverBeenBound;
    75     WebGLImageDataStatus mImageDataStatus;
    77     friend class WebGLFramebuffer;
    78 };
    79 } // namespace mozilla
    81 #endif

mercurial