| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
| 8 | 8 |
| 9 #include "GeometryBinding.h" | 9 #include "GeometryBinding.h" |
| 10 | 10 |
| 11 #include "CCRendererGL.h" // For the GLC() macro. | 11 #include "CCRendererGL.h" // For the GLC() macro. |
| 12 #include "GraphicsContext3D.h" | 12 #include "GraphicsContext3D.h" |
| 13 #include <public/WebGraphicsContext3D.h> | 13 #include <public/WebGraphicsContext3D.h> |
| 14 | 14 |
| 15 namespace WebCore { | 15 namespace cc { |
| 16 | 16 |
| 17 GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context, const Fl
oatRect& quadVertexRect) | 17 GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context, const Fl
oatRect& quadVertexRect) |
| 18 : m_context(context) | 18 : m_context(context) |
| 19 , m_quadVerticesVbo(0) | 19 , m_quadVerticesVbo(0) |
| 20 , m_quadElementsVbo(0) | 20 , m_quadElementsVbo(0) |
| 21 , m_initialized(false) | 21 , m_initialized(false) |
| 22 { | 22 { |
| 23 // Vertex positions and texture coordinates for the 4 corners of a 1x1 quad. | 23 // Vertex positions and texture coordinates for the 4 corners of a 1x1 quad. |
| 24 float vertices[] = { quadVertexRect.x(), quadVertexRect.maxY(), 0.0f, 0.0f,
1.0f, | 24 float vertices[] = { quadVertexRect.x(), quadVertexRect.maxY(), 0.0f, 0.0f,
1.0f, |
| 25 quadVertexRect.x(), quadVertexRect.y(), 0.0f, 0.0f, 0.
0f, | 25 quadVertexRect.x(), quadVertexRect.y(), 0.0f, 0.0f, 0.
0f, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, quadVe
rticesVbo())); | 49 GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, quadVe
rticesVbo())); |
| 50 GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER
, quadElementsVbo())); | 50 GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER
, quadElementsVbo())); |
| 51 unsigned offset = 0; | 51 unsigned offset = 0; |
| 52 GLC(m_context, m_context->vertexAttribPointer(positionAttribLocation(), 3, G
raphicsContext3D::FLOAT, false, 5 * sizeof(float), offset)); | 52 GLC(m_context, m_context->vertexAttribPointer(positionAttribLocation(), 3, G
raphicsContext3D::FLOAT, false, 5 * sizeof(float), offset)); |
| 53 offset += 3 * sizeof(float); | 53 offset += 3 * sizeof(float); |
| 54 GLC(m_context, m_context->vertexAttribPointer(texCoordAttribLocation(), 2, G
raphicsContext3D::FLOAT, false, 5 * sizeof(float), offset)); | 54 GLC(m_context, m_context->vertexAttribPointer(texCoordAttribLocation(), 2, G
raphicsContext3D::FLOAT, false, 5 * sizeof(float), offset)); |
| 55 GLC(m_context, m_context->enableVertexAttribArray(positionAttribLocation()))
; | 55 GLC(m_context, m_context->enableVertexAttribArray(positionAttribLocation()))
; |
| 56 GLC(m_context, m_context->enableVertexAttribArray(texCoordAttribLocation()))
; | 56 GLC(m_context, m_context->enableVertexAttribArray(texCoordAttribLocation()))
; |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace WebCore | 59 } // namespace cc |
| 60 | 60 |
| 61 #endif // USE(ACCELERATED_COMPOSITING) | 61 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |