Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1153)

Side by Side Diff: Source/core/html/canvas/OESVertexArrayObject.cpp

Issue 223223003: Re-land "WebGL: Transfer ownership of WebGraphicsContext3D to DrawingBuffer" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix errata on comment Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/html/canvas/WebGLBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array Object) 67 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array Object)
68 { 68 {
69 if (!arrayObject || isLost()) 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(nullptr); 73 m_context->setBoundVertexArrayObject(nullptr);
74 74
75 arrayObject->deleteObject(m_context->webGraphicsContext3D()); 75 arrayObject->deleteObject(m_context->webContext());
76 } 76 }
77 77
78 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra yObject) 78 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra yObject)
79 { 79 {
80 if (!arrayObject || isLost()) 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 return m_context->webGraphicsContext3D()->isVertexArrayOES(arrayObject->obje ct()); 86 return m_context->webContext()->isVertexArrayOES(arrayObject->object());
87 } 87 }
88 88
89 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb ject) 89 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb ject)
90 { 90 {
91 if (isLost()) 91 if (isLost())
92 return; 92 return;
93 93
94 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, co ntext()))) { 94 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, co ntext()))) {
95 m_context->webGraphicsContext3D()->synthesizeGLError(GL_INVALID_OPERATIO N); 95 m_context->webContext()->synthesizeGLError(GL_INVALID_OPERATION);
96 return; 96 return;
97 } 97 }
98 98
99 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { 99 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) {
100 m_context->webGraphicsContext3D()->bindVertexArrayOES(arrayObject->objec t()); 100 m_context->webContext()->bindVertexArrayOES(arrayObject->object());
101 101
102 arrayObject->setHasEverBeenBound(); 102 arrayObject->setHasEverBeenBound();
103 m_context->setBoundVertexArrayObject(arrayObject); 103 m_context->setBoundVertexArrayObject(arrayObject);
104 } else { 104 } else {
105 m_context->webGraphicsContext3D()->bindVertexArrayOES(0); 105 m_context->webContext()->bindVertexArrayOES(0);
106 m_context->setBoundVertexArrayObject(nullptr); 106 m_context->setBoundVertexArrayObject(nullptr);
107 } 107 }
108 } 108 }
109 109
110 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context) 110 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context)
111 { 111 {
112 return context->extensionsUtil()->supportsExtension("GL_OES_vertex_array_obj ect"); 112 return context->extensionsUtil()->supportsExtension("GL_OES_vertex_array_obj ect");
113 } 113 }
114 114
115 const char* OESVertexArrayObject::extensionName() 115 const char* OESVertexArrayObject::extensionName()
116 { 116 {
117 return "OES_vertex_array_object"; 117 return "OES_vertex_array_object";
118 } 118 }
119 119
120 } // namespace WebCore 120 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/canvas/WebGLBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698