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

Unified Diff: cc/output/geometry_binding.cc

Issue 14600002: HW draw workarounds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixups to force hw with this patch Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/geometry_binding.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_));
« no previous file with comments | « cc/output/geometry_binding.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698