Chromium Code Reviews| Index: Source/modules/webgl/WebGLFramebuffer.cpp |
| diff --git a/Source/modules/webgl/WebGLFramebuffer.cpp b/Source/modules/webgl/WebGLFramebuffer.cpp |
| index 2246d54f3d470b3e0c5c2cac7f7a6f1a74427216..a3f6a12c2d288600484c7669a66fe476fdffcd94 100644 |
| --- a/Source/modules/webgl/WebGLFramebuffer.cpp |
| +++ b/Source/modules/webgl/WebGLFramebuffer.cpp |
| @@ -36,216 +36,217 @@ namespace blink { |
| namespace { |
| - class WebGLRenderbufferAttachment final : public WebGLFramebuffer::WebGLAttachment { |
|
Ken Russell (switch to Gerrit)
2015/08/01 00:11:56
The whitespace changes in this file are unfortunat
peria
2015/08/03 09:00:36
Acknowledged.
https://codereview.chromium.org/1267
|
| - public: |
| - static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLRenderbuffer*); |
| - |
| - DECLARE_VIRTUAL_TRACE(); |
| - |
| - private: |
| - explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*); |
| - WebGLRenderbufferAttachment() { } |
| - |
| - GLsizei width() const override; |
| - GLsizei height() const override; |
| - GLenum format() const override; |
| - GLenum type() const override; |
| - WebGLSharedObject* object() const override; |
| - bool isSharedObject(WebGLSharedObject*) const override; |
| - bool valid() const override; |
| - void onDetached(WebGraphicsContext3D*) override; |
| - void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| - void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| - |
| - RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer; |
| - }; |
| - |
| - PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer) |
| - { |
| - return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer)); |
| - } |
| +class WebGLRenderbufferAttachment final : public WebGLFramebuffer::WebGLAttachment { |
| +public: |
| + static WebGLFramebuffer::WebGLAttachment* create(WebGLRenderbuffer*); |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| +private: |
| + explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*); |
| + WebGLRenderbufferAttachment() { } |
| + |
| + GLsizei width() const override; |
| + GLsizei height() const override; |
| + GLenum format() const override; |
| + GLenum type() const override; |
| + WebGLSharedObject* object() const override; |
| + bool isSharedObject(WebGLSharedObject*) const override; |
| + bool valid() const override; |
| + void onDetached(WebGraphicsContext3D*) override; |
| + void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| + void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| + |
| + Member<WebGLRenderbuffer> m_renderbuffer; |
| +}; |
| + |
| +WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer) |
| +{ |
| + return new WebGLRenderbufferAttachment(renderbuffer); |
| +} |
| - DEFINE_TRACE(WebGLRenderbufferAttachment) |
| - { |
| - visitor->trace(m_renderbuffer); |
| - WebGLFramebuffer::WebGLAttachment::trace(visitor); |
| - } |
| +DEFINE_TRACE(WebGLRenderbufferAttachment) |
| +{ |
| + visitor->trace(m_renderbuffer); |
| + WebGLFramebuffer::WebGLAttachment::trace(visitor); |
| +} |
| - WebGLRenderbufferAttachment::WebGLRenderbufferAttachment(WebGLRenderbuffer* renderbuffer) |
| +WebGLRenderbufferAttachment::WebGLRenderbufferAttachment(WebGLRenderbuffer* renderbuffer) |
| : m_renderbuffer(renderbuffer) |
| - { |
| - } |
| +{ |
| +} |
| - GLsizei WebGLRenderbufferAttachment::width() const |
| - { |
| - return m_renderbuffer->width(); |
| - } |
| +GLsizei WebGLRenderbufferAttachment::width() const |
| +{ |
| + return m_renderbuffer->width(); |
| +} |
| - GLsizei WebGLRenderbufferAttachment::height() const |
| - { |
| - return m_renderbuffer->height(); |
| - } |
| +GLsizei WebGLRenderbufferAttachment::height() const |
| +{ |
| + return m_renderbuffer->height(); |
| +} |
| - GLenum WebGLRenderbufferAttachment::format() const |
| - { |
| - GLenum format = m_renderbuffer->internalFormat(); |
| - if (format == GL_DEPTH_STENCIL_OES |
| - && m_renderbuffer->emulatedStencilBuffer() |
| - && m_renderbuffer->emulatedStencilBuffer()->internalFormat() != GL_STENCIL_INDEX8) { |
| - return 0; |
| - } |
| - return format; |
| +GLenum WebGLRenderbufferAttachment::format() const |
| +{ |
| + GLenum format = m_renderbuffer->internalFormat(); |
| + if (format == GL_DEPTH_STENCIL_OES |
| + && m_renderbuffer->emulatedStencilBuffer() |
| + && m_renderbuffer->emulatedStencilBuffer()->internalFormat() != GL_STENCIL_INDEX8) { |
| + return 0; |
| } |
| + return format; |
| +} |
| - WebGLSharedObject* WebGLRenderbufferAttachment::object() const |
| - { |
| - return m_renderbuffer->object() ? m_renderbuffer.get() : 0; |
| - } |
| +WebGLSharedObject* WebGLRenderbufferAttachment::object() const |
| +{ |
| + return m_renderbuffer->object() ? m_renderbuffer.get() : 0; |
| +} |
| - bool WebGLRenderbufferAttachment::isSharedObject(WebGLSharedObject* object) const |
| - { |
| - return object == m_renderbuffer; |
| - } |
| +bool WebGLRenderbufferAttachment::isSharedObject(WebGLSharedObject* object) const |
| +{ |
| + return object == m_renderbuffer; |
| +} |
| - bool WebGLRenderbufferAttachment::valid() const |
| - { |
| - return m_renderbuffer->object(); |
| - } |
| +bool WebGLRenderbufferAttachment::valid() const |
| +{ |
| + return m_renderbuffer->object(); |
| +} |
| - void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context) |
| - { |
| - m_renderbuffer->onDetached(context); |
| - } |
| +void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context) |
| +{ |
| + m_renderbuffer->onDetached(context); |
| +} |
| - void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment) |
| - { |
| - Platform3DObject object = objectOrZero(m_renderbuffer.get()); |
| - if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && m_renderbuffer->emulatedStencilBuffer()) { |
| - context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, object); |
| - context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, objectOrZero(m_renderbuffer->emulatedStencilBuffer())); |
| - } else { |
| - context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, object); |
| - } |
| +void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment) |
| +{ |
| + Platform3DObject object = objectOrZero(m_renderbuffer.get()); |
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && m_renderbuffer->emulatedStencilBuffer()) { |
| + context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, object); |
| + context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, objectOrZero(m_renderbuffer->emulatedStencilBuffer())); |
| + } else { |
| + context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, object); |
| } |
| +} |
| - void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment) |
| - { |
| - if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| - context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0); |
| - context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); |
| - } else { |
| - context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, 0); |
| - } |
| +void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment) |
| +{ |
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| + context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0); |
| + context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); |
| + } else { |
| + context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, 0); |
| } |
| +} |
| - GLenum WebGLRenderbufferAttachment::type() const |
| - { |
| - return 0; |
| - } |
| +GLenum WebGLRenderbufferAttachment::type() const |
| +{ |
| + notImplemented(); |
| + return 0; |
| +} |
| - class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { |
| - public: |
| - static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture*, GLenum target, GLint level); |
| - |
| - DECLARE_VIRTUAL_TRACE(); |
| - |
| - private: |
| - WebGLTextureAttachment(WebGLTexture*, GLenum target, GLint level); |
| - WebGLTextureAttachment() { } |
| - |
| - GLsizei width() const override; |
| - GLsizei height() const override; |
| - GLenum format() const override; |
| - GLenum type() const override; |
| - WebGLSharedObject* object() const override; |
| - bool isSharedObject(WebGLSharedObject*) const override; |
| - bool valid() const override; |
| - void onDetached(WebGraphicsContext3D*) override; |
| - void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| - void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| - |
| - RefPtrWillBeMember<WebGLTexture> m_texture; |
| - GLenum m_target; |
| - GLint m_level; |
| - }; |
| - |
| - PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttachment::create(WebGLTexture* texture, GLenum target, GLint level) |
| - { |
| - return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, level)); |
| - } |
| +class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { |
| +public: |
| + static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, GLenum target, GLint level); |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| +private: |
| + WebGLTextureAttachment(WebGLTexture*, GLenum target, GLint level); |
| + WebGLTextureAttachment() { } |
| + |
| + GLsizei width() const override; |
| + GLsizei height() const override; |
| + GLenum format() const override; |
| + GLenum type() const override; |
| + WebGLSharedObject* object() const override; |
| + bool isSharedObject(WebGLSharedObject*) const override; |
| + bool valid() const override; |
| + void onDetached(WebGraphicsContext3D*) override; |
| + void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| + void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| + |
| + Member<WebGLTexture> m_texture; |
| + GLenum m_target; |
| + GLint m_level; |
| +}; |
| + |
| +WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create(WebGLTexture* texture, GLenum target, GLint level) |
| +{ |
| + return new WebGLTextureAttachment(texture, target, level); |
| +} |
| - DEFINE_TRACE(WebGLTextureAttachment) |
| - { |
| - visitor->trace(m_texture); |
| - WebGLFramebuffer::WebGLAttachment::trace(visitor); |
| - } |
| +DEFINE_TRACE(WebGLTextureAttachment) |
| +{ |
| + visitor->trace(m_texture); |
| + WebGLFramebuffer::WebGLAttachment::trace(visitor); |
| +} |
| - WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, GLenum target, GLint level) |
| +WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, GLenum target, GLint level) |
| : m_texture(texture) |
| , m_target(target) |
| , m_level(level) |
| - { |
| - } |
| +{ |
| +} |
| - GLsizei WebGLTextureAttachment::width() const |
| - { |
| - return m_texture->getWidth(m_target, m_level); |
| - } |
| +GLsizei WebGLTextureAttachment::width() const |
| +{ |
| + return m_texture->getWidth(m_target, m_level); |
| +} |
| - GLsizei WebGLTextureAttachment::height() const |
| - { |
| - return m_texture->getHeight(m_target, m_level); |
| - } |
| +GLsizei WebGLTextureAttachment::height() const |
| +{ |
| + return m_texture->getHeight(m_target, m_level); |
| +} |
| - GLenum WebGLTextureAttachment::format() const |
| - { |
| - return m_texture->getInternalFormat(m_target, m_level); |
| - } |
| +GLenum WebGLTextureAttachment::format() const |
| +{ |
| + return m_texture->getInternalFormat(m_target, m_level); |
| +} |
| - WebGLSharedObject* WebGLTextureAttachment::object() const |
| - { |
| - return m_texture->object() ? m_texture.get() : 0; |
| - } |
| +WebGLSharedObject* WebGLTextureAttachment::object() const |
| +{ |
| + return m_texture->object() ? m_texture.get() : 0; |
| +} |
| - bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const |
| - { |
| - return object == m_texture; |
| - } |
| +bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const |
| +{ |
| + return object == m_texture; |
| +} |
| - bool WebGLTextureAttachment::valid() const |
| - { |
| - return m_texture->object(); |
| - } |
| +bool WebGLTextureAttachment::valid() const |
| +{ |
| + return m_texture->object(); |
| +} |
| - void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context) |
| - { |
| - m_texture->onDetached(context); |
| - } |
| +void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context) |
| +{ |
| + m_texture->onDetached(context); |
| +} |
| - void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment) |
| - { |
| - Platform3DObject object = objectOrZero(m_texture.get()); |
| - context->framebufferTexture2D(target, attachment, m_target, object, m_level); |
| - } |
| +void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment) |
| +{ |
| + Platform3DObject object = objectOrZero(m_texture.get()); |
| + context->framebufferTexture2D(target, attachment, m_target, object, m_level); |
| +} |
| - void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment) |
| - { |
| - if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| - context->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, m_target, 0, m_level); |
| - context->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, m_target, 0, m_level); |
| - } else { |
| - context->framebufferTexture2D(target, attachment, m_target, 0, m_level); |
| - } |
| +void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment) |
| +{ |
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| + context->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, m_target, 0, m_level); |
| + context->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, m_target, 0, m_level); |
| + } else { |
| + context->framebufferTexture2D(target, attachment, m_target, 0, m_level); |
| } |
| +} |
| - GLenum WebGLTextureAttachment::type() const |
| - { |
| - return m_texture->getType(m_target, m_level); |
| - } |
| +GLenum WebGLTextureAttachment::type() const |
| +{ |
| + return m_texture->getType(m_target, m_level); |
| +} |
| - bool isColorRenderable(GLenum internalformat) |
| - { |
| - switch (internalformat) { |
| +bool isColorRenderable(GLenum internalformat) |
| +{ |
| + switch (internalformat) { |
| case GL_RGB: |
| case GL_RGBA: |
| case GL_SRGB_ALPHA_EXT: |
| @@ -280,12 +281,12 @@ namespace { |
| return true; |
| default: |
| return false; |
| - } |
| } |
| +} |
| - bool isDepthRenderable(GLenum internalformat, bool includesDepthStencil) |
| - { |
| - switch (internalformat) { |
| +bool isDepthRenderable(GLenum internalformat, bool includesDepthStencil) |
| +{ |
| + switch (internalformat) { |
| case GL_DEPTH_COMPONENT: |
| case GL_DEPTH_COMPONENT16: |
| case GL_DEPTH_COMPONENT24: |
| @@ -297,12 +298,12 @@ namespace { |
| return includesDepthStencil; |
| default: |
| return false; |
| - } |
| } |
| +} |
| - bool isStencilRenderable(GLenum internalformat, bool includesDepthStencil) |
| - { |
| - switch (internalformat) { |
| +bool isStencilRenderable(GLenum internalformat, bool includesDepthStencil) |
| +{ |
| + switch (internalformat) { |
| case GL_STENCIL_INDEX8: |
| return true; |
| case GL_DEPTH_STENCIL: |
| @@ -311,8 +312,8 @@ namespace { |
| return includesDepthStencil; |
| default: |
| return false; |
| - } |
| } |
| +} |
| } // anonymous namespace |
| @@ -324,9 +325,9 @@ WebGLFramebuffer::WebGLAttachment::~WebGLAttachment() |
| { |
| } |
| -PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLFramebuffer::create(WebGLRenderingContextBase* ctx) |
| +WebGLFramebuffer* WebGLFramebuffer::create(WebGLRenderingContextBase* ctx) |
| { |
| - return adoptRefWillBeNoop(new WebGLFramebuffer(ctx)); |
| + return new WebGLFramebuffer(ctx); |
| } |
| WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContextBase* ctx) |
| @@ -663,9 +664,7 @@ bool WebGLFramebuffer::getReadBufferFormatAndType(GLenum* format, GLenum* type) |
| DEFINE_TRACE(WebGLFramebuffer) |
| { |
| -#if ENABLE(OILPAN) |
| visitor->trace(m_attachments); |
| -#endif |
| WebGLContextObject::trace(visitor); |
| } |