| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 OESVertexArrayObject::~OESVertexArrayObject() | 43 OESVertexArrayObject::~OESVertexArrayObject() |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 WebGLExtension::ExtensionName OESVertexArrayObject::getName() const | 47 WebGLExtension::ExtensionName OESVertexArrayObject::getName() const |
| 48 { | 48 { |
| 49 return OESVertexArrayObjectName; | 49 return OESVertexArrayObjectName; |
| 50 } | 50 } |
| 51 | 51 |
| 52 PassOwnPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingCont
ext* context) | 52 PassRefPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingCont
ext* context) |
| 53 { | 53 { |
| 54 return adoptPtr(new OESVertexArrayObject(context)); | 54 return adoptRef(new OESVertexArrayObject(context)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES
() | 57 PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES
() |
| 58 { | 58 { |
| 59 if (m_context->isContextLost()) | 59 if (isLost()) |
| 60 return 0; | 60 return 0; |
| 61 | 61 |
| 62 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_co
ntext, WebGLVertexArrayObjectOES::VaoTypeUser); | 62 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_co
ntext, WebGLVertexArrayObjectOES::VaoTypeUser); |
| 63 m_context->addContextObject(o.get()); | 63 m_context->addContextObject(o.get()); |
| 64 return o.release(); | 64 return o.release(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array
Object) | 67 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array
Object) |
| 68 { | 68 { |
| 69 if (!arrayObject || m_context->isContextLost()) | 69 if (!arrayObject || isLost()) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVert
exArrayObject) | 72 if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVert
exArrayObject) |
| 73 m_context->setBoundVertexArrayObject(0); | 73 m_context->setBoundVertexArrayObject(0); |
| 74 | 74 |
| 75 arrayObject->deleteObject(m_context->graphicsContext3D()); | 75 arrayObject->deleteObject(m_context->graphicsContext3D()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 GC3Dboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* ar
rayObject) | 78 GC3Dboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* ar
rayObject) |
| 79 { | 79 { |
| 80 if (!arrayObject || m_context->isContextLost()) | 80 if (!arrayObject || isLost()) |
| 81 return 0; | 81 return 0; |
| 82 | 82 |
| 83 if (!arrayObject->hasEverBeenBound()) | 83 if (!arrayObject->hasEverBeenBound()) |
| 84 return 0; | 84 return 0; |
| 85 | 85 |
| 86 Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); | 86 Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); |
| 87 return extensions->isVertexArrayOES(arrayObject->object()); | 87 return extensions->isVertexArrayOES(arrayObject->object()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb
ject, ExceptionCode& ec) | 90 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb
ject, ExceptionCode& ec) |
| 91 { | 91 { |
| 92 UNUSED_PARAM(ec); | 92 UNUSED_PARAM(ec); |
| 93 if (m_context->isContextLost()) | 93 if (isLost()) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, co
ntext()))) { | 96 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, co
ntext()))) { |
| 97 m_context->graphicsContext3D()->synthesizeGLError(GraphicsContext3D::INV
ALID_OPERATION); | 97 m_context->graphicsContext3D()->synthesizeGLError(GraphicsContext3D::INV
ALID_OPERATION); |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 | 100 |
| 101 Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); | 101 Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); |
| 102 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object())
{ | 102 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object())
{ |
| 103 extensions->bindVertexArrayOES(arrayObject->object()); | 103 extensions->bindVertexArrayOES(arrayObject->object()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 115 Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); | 115 Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); |
| 116 return extensions->supports("GL_OES_vertex_array_object"); | 116 return extensions->supports("GL_OES_vertex_array_object"); |
| 117 } | 117 } |
| 118 | 118 |
| 119 const char* OESVertexArrayObject::getExtensionName() | 119 const char* OESVertexArrayObject::getExtensionName() |
| 120 { | 120 { |
| 121 return "OES_vertex_array_object"; | 121 return "OES_vertex_array_object"; |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace WebCore | 124 } // namespace WebCore |
| OLD | NEW |