| Index: cc/output/geometry_binding.cc
|
| diff --git a/cc/output/geometry_binding.cc b/cc/output/geometry_binding.cc
|
| index e3bf5909cf957693b1b4d854b0dcac45bbd45791..e5b96fb0b60c5430d79dbb484545c331b635719e 100644
|
| --- a/cc/output/geometry_binding.cc
|
| +++ b/cc/output/geometry_binding.cc
|
| @@ -7,15 +7,23 @@
|
| #include "cc/output/gl_renderer.h" // For the GLC() macro.
|
| #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
|
| #include "third_party/khronos/GLES2/gl2.h"
|
| -#include "ui/gfx/rect_f.h"
|
|
|
| namespace cc {
|
|
|
| GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context,
|
| const gfx::RectF& quad_vertex_rect)
|
| - : context_(context),
|
| + : quad_vertex_rect_(quad_vertex_rect),
|
| + context_(context),
|
| quad_vertices_vbo_(0),
|
| quad_elements_vbo_(0) {
|
| +}
|
| +
|
| +GeometryBinding::~GeometryBinding() {
|
| + GLC(context_, context_->deleteBuffer(quad_vertices_vbo_));
|
| + GLC(context_, context_->deleteBuffer(quad_elements_vbo_));
|
| +}
|
| +
|
| +void GeometryBinding::PrepareForDraw() {
|
| struct Vertex {
|
| float a_position[3];
|
| float a_texCoord[2];
|
| @@ -39,17 +47,17 @@ GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context,
|
| Quad quad_list[8];
|
| QuadIndex quad_index_list[8];
|
| for (int i = 0; i < 8; i++) {
|
| - Vertex v0 = { { quad_vertex_rect.x(), quad_vertex_rect.bottom(), 0.0f, },
|
| + Vertex v0 = { { quad_vertex_rect_.x(), quad_vertex_rect_.bottom(), 0.0f, },
|
| { 0.0f, 1.0f, },
|
| i * 4.0f + 0.0f };
|
| - Vertex v1 = { { quad_vertex_rect.x(), quad_vertex_rect.y(), 0.0f, },
|
| + Vertex v1 = { { quad_vertex_rect_.x(), quad_vertex_rect_.y(), 0.0f, },
|
| { 0.0f, 0.0f, },
|
| i * 4.0f + 1.0f };
|
| - Vertex v2 = { { quad_vertex_rect.right(), quad_vertex_rect.y(), 0.0f, },
|
| + Vertex v2 = { { quad_vertex_rect_.right(), quad_vertex_rect_.y(), 0.0f, },
|
| { 1.0f, .0f, },
|
| i * 4.0f + 2.0f };
|
| - Vertex v3 = { { quad_vertex_rect.right(),
|
| - quad_vertex_rect.bottom(),
|
| + Vertex v3 = { { quad_vertex_rect_.right(),
|
| + quad_vertex_rect_.bottom(),
|
| 0.0f, },
|
| { 1.0f, 1.0f, },
|
| i * 4.0f + 3.0f };
|
| @@ -64,6 +72,7 @@ GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context,
|
| quad_index_list[i] = y;
|
| }
|
|
|
| + // Leaks
|
| GLC(context_, quad_vertices_vbo_ = context_->createBuffer());
|
| GLC(context_, quad_elements_vbo_ = context_->createBuffer());
|
| GLC(context_, context_->bindBuffer(GL_ARRAY_BUFFER, quad_vertices_vbo_));
|
| @@ -77,14 +86,7 @@ GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context,
|
| sizeof(quad_index_list),
|
| quad_index_list,
|
| GL_STATIC_DRAW));
|
| -}
|
|
|
| -GeometryBinding::~GeometryBinding() {
|
| - GLC(context_, context_->deleteBuffer(quad_vertices_vbo_));
|
| - GLC(context_, context_->deleteBuffer(quad_elements_vbo_));
|
| -}
|
| -
|
| -void GeometryBinding::PrepareForDraw() {
|
| GLC(context_,
|
| context_->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, quad_elements_vbo_));
|
|
|
|
|