Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/output/static_geometry_binding.h" | 5 #include "cc/output/static_geometry_binding.h" |
| 6 | 6 |
| 7 #include "cc/output/gl_renderer.h" // For the GLC() macro. | 7 #include "cc/output/gl_renderer.h" // For the GLC() macro. |
| 8 #include "gpu/command_buffer/client/gles2_interface.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
| 9 #include "ui/gfx/geometry/rect_f.h" | 9 #include "ui/gfx/geometry/rect_f.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 GeometryBindingVertex v2 = { | 33 GeometryBindingVertex v2 = { |
| 34 {quad_vertex_rect.right(), quad_vertex_rect.y(), 0.0f}, | 34 {quad_vertex_rect.right(), quad_vertex_rect.y(), 0.0f}, |
| 35 {1.0f, 0.0f}, | 35 {1.0f, 0.0f}, |
| 36 i * 4.0f + 2.0f}; | 36 i * 4.0f + 2.0f}; |
| 37 GeometryBindingVertex v3 = { | 37 GeometryBindingVertex v3 = { |
| 38 {quad_vertex_rect.right(), quad_vertex_rect.bottom(), 0.0f}, | 38 {quad_vertex_rect.right(), quad_vertex_rect.bottom(), 0.0f}, |
| 39 {1.0f, 1.0f}, | 39 {1.0f, 1.0f}, |
| 40 i * 4.0f + 3.0f}; | 40 i * 4.0f + 3.0f}; |
| 41 GeometryBindingQuad x = {v0, v1, v2, v3}; | 41 GeometryBindingQuad x = {v0, v1, v2, v3}; |
| 42 quads[i] = x; | 42 quads[i] = x; |
| 43 GeometryBindingQuadIndex y = {{static_cast<uint16>(0 + 4 * i), | 43 GeometryBindingQuadIndex y = {static_cast<uint16>(0 + 4 * i), |
|
enne (OOO)
2015/02/27 22:12:07
Use direct or copy initialization, not list initia
| |
| 44 static_cast<uint16>(1 + 4 * i), | 44 static_cast<uint16>(1 + 4 * i), |
| 45 static_cast<uint16>(2 + 4 * i), | 45 static_cast<uint16>(2 + 4 * i), |
| 46 static_cast<uint16>(3 + 4 * i), | 46 static_cast<uint16>(3 + 4 * i), |
| 47 static_cast<uint16>(0 + 4 * i), | 47 static_cast<uint16>(0 + 4 * i), |
| 48 static_cast<uint16>(2 + 4 * i)}}; | 48 static_cast<uint16>(2 + 4 * i)}; |
| 49 quad_indices[i] = y; | 49 quad_indices[i] = y; |
| 50 } | 50 } |
| 51 | 51 |
| 52 GLC(gl_, gl_->GenBuffers(1, &quad_vertices_vbo_)); | 52 GLC(gl_, gl_->GenBuffers(1, &quad_vertices_vbo_)); |
| 53 GLC(gl_, gl_->GenBuffers(1, &quad_elements_vbo_)); | 53 GLC(gl_, gl_->GenBuffers(1, &quad_elements_vbo_)); |
| 54 | 54 |
| 55 GLC(gl_, gl_->BindBuffer(GL_ARRAY_BUFFER, quad_vertices_vbo_)); | 55 GLC(gl_, gl_->BindBuffer(GL_ARRAY_BUFFER, quad_vertices_vbo_)); |
| 56 GLC(gl_, gl_->BufferData(GL_ARRAY_BUFFER, sizeof(GeometryBindingQuad) * 8, | 56 GLC(gl_, gl_->BufferData(GL_ARRAY_BUFFER, sizeof(GeometryBindingQuad) * 8, |
| 57 quads, GL_STATIC_DRAW)); | 57 quads, GL_STATIC_DRAW)); |
| 58 | 58 |
| 59 GLC(gl_, gl_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, quad_elements_vbo_)); | 59 GLC(gl_, gl_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, quad_elements_vbo_)); |
| 60 GLC(gl_, gl_->BufferData(GL_ELEMENT_ARRAY_BUFFER, | 60 GLC(gl_, gl_->BufferData(GL_ELEMENT_ARRAY_BUFFER, |
| 61 sizeof(GeometryBindingQuadIndex) * 8, &quad_indices, | 61 sizeof(GeometryBindingQuadIndex) * 8, &quad_indices, |
| 62 GL_STATIC_DRAW)); | 62 GL_STATIC_DRAW)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 StaticGeometryBinding::~StaticGeometryBinding() { | 65 StaticGeometryBinding::~StaticGeometryBinding() { |
| 66 gl_->DeleteBuffers(1, &quad_vertices_vbo_); | 66 gl_->DeleteBuffers(1, &quad_vertices_vbo_); |
| 67 gl_->DeleteBuffers(1, &quad_elements_vbo_); | 67 gl_->DeleteBuffers(1, &quad_elements_vbo_); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void StaticGeometryBinding::PrepareForDraw() { | 70 void StaticGeometryBinding::PrepareForDraw() { |
| 71 SetupGLContext(gl_, quad_elements_vbo_, quad_vertices_vbo_); | 71 SetupGLContext(gl_, quad_elements_vbo_, quad_vertices_vbo_); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace cc | 74 } // namespace cc |
| OLD | NEW |