| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 WebGLRenderbuffer* WebGLRenderbuffer::create(WebGLRenderingContextBase* ctx) | 32 WebGLRenderbuffer* WebGLRenderbuffer::create(WebGLRenderingContextBase* ctx) |
| 33 { | 33 { |
| 34 return new WebGLRenderbuffer(ctx); | 34 return new WebGLRenderbuffer(ctx); |
| 35 } | 35 } |
| 36 | 36 |
| 37 WebGLRenderbuffer::~WebGLRenderbuffer() | 37 WebGLRenderbuffer::~WebGLRenderbuffer() |
| 38 { | 38 { |
| 39 // This render buffer (heap) object must finalize itself. | |
| 40 m_emulatedStencilBuffer.clear(); | |
| 41 | |
| 42 // See the comment in WebGLObject::detachAndDeleteObject(). | 39 // See the comment in WebGLObject::detachAndDeleteObject(). |
| 43 detachAndDeleteObject(); | 40 detachAndDeleteObject(); |
| 44 } | 41 } |
| 45 | 42 |
| 46 WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContextBase* ctx) | 43 WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContextBase* ctx) |
| 47 : WebGLSharedPlatform3DObject(ctx) | 44 : WebGLSharedPlatform3DObject(ctx) |
| 48 , m_internalFormat(GL_RGBA4) | 45 , m_internalFormat(GL_RGBA4) |
| 49 , m_width(0) | 46 , m_width(0) |
| 50 , m_height(0) | 47 , m_height(0) |
| 51 , m_hasEverBeenBound(false) | 48 , m_hasEverBeenBound(false) |
| 52 { | 49 { |
| 53 setObject(ctx->webContext()->createRenderbuffer()); | 50 setObject(ctx->webContext()->createRenderbuffer()); |
| 54 } | 51 } |
| 55 | 52 |
| 56 void WebGLRenderbuffer::deleteObjectImpl(WebGraphicsContext3D* context3d) | 53 void WebGLRenderbuffer::deleteObjectImpl(WebGraphicsContext3D* context3d) |
| 57 { | 54 { |
| 58 context3d->deleteRenderbuffer(m_object); | 55 context3d->deleteRenderbuffer(m_object); |
| 59 m_object = 0; | 56 m_object = 0; |
| 60 deleteEmulatedStencilBuffer(context3d); | |
| 61 } | |
| 62 | |
| 63 void WebGLRenderbuffer::deleteEmulatedStencilBuffer(WebGraphicsContext3D* contex
t3d) | |
| 64 { | |
| 65 if (!m_emulatedStencilBuffer) | |
| 66 return; | |
| 67 m_emulatedStencilBuffer->deleteObject(context3d); | |
| 68 m_emulatedStencilBuffer.clear(); | |
| 69 } | 57 } |
| 70 | 58 |
| 71 DEFINE_TRACE(WebGLRenderbuffer) | 59 DEFINE_TRACE(WebGLRenderbuffer) |
| 72 { | 60 { |
| 73 visitor->trace(m_emulatedStencilBuffer); | |
| 74 WebGLSharedPlatform3DObject::trace(visitor); | 61 WebGLSharedPlatform3DObject::trace(visitor); |
| 75 } | 62 } |
| 76 | 63 |
| 77 } // namespace blink | 64 } // namespace blink |
| OLD | NEW |