diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/canvas/OESVertexArrayObject.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/html/canvas/OESVertexArrayObject.cpp')
-rw-r--r-- | Source/WebCore/html/canvas/OESVertexArrayObject.cpp | 78 |
1 files changed, 30 insertions, 48 deletions
diff --git a/Source/WebCore/html/canvas/OESVertexArrayObject.cpp b/Source/WebCore/html/canvas/OESVertexArrayObject.cpp index 36ab832d9..111bc3be6 100644 --- a/Source/WebCore/html/canvas/OESVertexArrayObject.cpp +++ b/Source/WebCore/html/canvas/OESVertexArrayObject.cpp @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,90 +24,72 @@ */ #include "config.h" +#include "OESVertexArrayObject.h" #if ENABLE(WEBGL) -#include "OESVertexArrayObject.h" - #include "Extensions3D.h" +#include "WebGLRenderingContext.h" namespace WebCore { -OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContext* context) +OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContextBase& context) : WebGLExtension(context) { } -OESVertexArrayObject::~OESVertexArrayObject() -{ -} - WebGLExtension::ExtensionName OESVertexArrayObject::getName() const { return OESVertexArrayObjectName; } -OwnPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingContext* context) +RefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES() { - return adoptPtr(new OESVertexArrayObject(context)); -} + if (m_context.isContextLost()) + return nullptr; -PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES() -{ - if (m_context->isContextLost()) - return 0; - - RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_context, WebGLVertexArrayObjectOES::VaoTypeUser); - m_context->addContextObject(o.get()); - return o.release(); + auto object = WebGLVertexArrayObjectOES::create(m_context, WebGLVertexArrayObjectOES::Type::User); + m_context.addContextObject(object.get()); + return WTFMove(object); } void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject) { - if (!arrayObject || m_context->isContextLost()) + if (!arrayObject || m_context.isContextLost()) return; - - if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVertexArrayObject) - m_context->setBoundVertexArrayObject(0); - arrayObject->deleteObject(m_context->graphicsContext3D()); + if (!arrayObject->isDefaultObject() && arrayObject == static_cast<WebGLRenderingContext&>(m_context).m_boundVertexArrayObject) + static_cast<WebGLRenderingContext&>(m_context).setBoundVertexArrayObject(nullptr); + + arrayObject->deleteObject(m_context.graphicsContext3D()); } GC3Dboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject) { - if (!arrayObject || m_context->isContextLost()) - return 0; - - if (!arrayObject->hasEverBeenBound()) - return 0; - - Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); - return extensions->isVertexArrayOES(arrayObject->object()); + return arrayObject && !m_context.isContextLost() && arrayObject->hasEverBeenBound() + && m_context.graphicsContext3D()->getExtensions().isVertexArrayOES(arrayObject->object()); } -void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject, ExceptionCode& ec) +void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject) { - UNUSED_PARAM(ec); - if (m_context->isContextLost()) + if (m_context.isContextLost()) return; - - if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, context()))) { - m_context->graphicsContext3D()->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + + if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(nullptr, context()))) { + m_context.graphicsContext3D()->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; } - - Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); + + auto& extensions = m_context.graphicsContext3D()->getExtensions(); + auto& context = downcast<WebGLRenderingContext>(m_context); if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { - extensions->bindVertexArrayOES(arrayObject->object()); - + extensions.bindVertexArrayOES(arrayObject->object()); arrayObject->setHasEverBeenBound(); - m_context->setBoundVertexArrayObject(arrayObject); + context.setBoundVertexArrayObject(arrayObject); } else { - extensions->bindVertexArrayOES(0); - m_context->setBoundVertexArrayObject(0); + extensions.bindVertexArrayOES(0); + context.setBoundVertexArrayObject(nullptr); } - - m_context->cleanupAfterGraphicsCall(false); } } // namespace WebCore |