| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "gpu/command_buffer/client/gles2_interface.h" | 28 #include "gpu/command_buffer/client/gles2_interface.h" |
| 29 #include "modules/webgl/WebGLRenderingContextBase.h" | 29 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 WebGLRenderbuffer* WebGLRenderbuffer::create(WebGLRenderingContextBase* ctx) { | 33 WebGLRenderbuffer* WebGLRenderbuffer::create(WebGLRenderingContextBase* ctx) { |
| 34 return new WebGLRenderbuffer(ctx); | 34 return new WebGLRenderbuffer(ctx); |
| 35 } | 35 } |
| 36 | 36 |
| 37 WebGLRenderbuffer::~WebGLRenderbuffer() { | |
| 38 // See the comment in WebGLObject::detachAndDeleteObject(). | |
| 39 detachAndDeleteObject(); | |
| 40 } | |
| 41 | |
| 42 WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContextBase* ctx) | 37 WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContextBase* ctx) |
| 43 : WebGLSharedPlatform3DObject(ctx), | 38 : WebGLSharedPlatform3DObject(ctx), |
| 44 m_internalFormat(GL_RGBA4), | 39 m_internalFormat(GL_RGBA4), |
| 45 m_width(0), | 40 m_width(0), |
| 46 m_height(0), | 41 m_height(0), |
| 47 m_hasEverBeenBound(false) { | 42 m_hasEverBeenBound(false) { |
| 48 GLuint rbo; | 43 GLuint rbo; |
| 49 ctx->contextGL()->GenRenderbuffers(1, &rbo); | 44 ctx->contextGL()->GenRenderbuffers(1, &rbo); |
| 50 setObject(rbo); | 45 setObject(rbo); |
| 51 } | 46 } |
| 52 | 47 |
| 48 WebGLRenderbuffer::~WebGLRenderbuffer() { |
| 49 runDestructor(); |
| 50 } |
| 51 |
| 53 void WebGLRenderbuffer::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) { | 52 void WebGLRenderbuffer::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) { |
| 54 gl->DeleteRenderbuffers(1, &m_object); | 53 gl->DeleteRenderbuffers(1, &m_object); |
| 55 m_object = 0; | 54 m_object = 0; |
| 56 } | 55 } |
| 57 | 56 |
| 58 DEFINE_TRACE(WebGLRenderbuffer) { | 57 DEFINE_TRACE(WebGLRenderbuffer) { |
| 59 WebGLSharedPlatform3DObject::trace(visitor); | 58 WebGLSharedPlatform3DObject::trace(visitor); |
| 60 } | 59 } |
| 61 | 60 |
| 62 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |