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

Side by Side Diff: cc/output/geometry_binding.cc

Issue 959403002: Initialize our quads to zero before we gl_->BufferData() with them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
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 "cc/output/geometry_binding.h" 5 #include "cc/output/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 24 matching lines...) Expand all
35 gl->VertexAttribPointer(GeometryBinding::TriangleIndexAttribLocation(), 1, 35 gl->VertexAttribPointer(GeometryBinding::TriangleIndexAttribLocation(), 1,
36 GL_FLOAT, false, 6 * sizeof(float), offsets[2])); 36 GL_FLOAT, false, 6 * sizeof(float), offsets[2]));
37 GLC(gl, 37 GLC(gl,
38 gl->EnableVertexAttribArray(GeometryBinding::PositionAttribLocation())); 38 gl->EnableVertexAttribArray(GeometryBinding::PositionAttribLocation()));
39 GLC(gl, 39 GLC(gl,
40 gl->EnableVertexAttribArray(GeometryBinding::TexCoordAttribLocation())); 40 gl->EnableVertexAttribArray(GeometryBinding::TexCoordAttribLocation()));
41 GLC(gl, gl->EnableVertexAttribArray( 41 GLC(gl, gl->EnableVertexAttribArray(
42 GeometryBinding::TriangleIndexAttribLocation())); 42 GeometryBinding::TriangleIndexAttribLocation()));
43 } 43 }
44 44
45 GeometryBindingQuad::GeometryBindingQuad() {
46 memset(&v0, 0x0, sizeof(GeometryBindingVertex));
danakj 2015/02/27 22:10:54 (0x0 is a very verbose way of just saying 0)
enne (OOO) 2015/02/27 22:12:07 Please no memset. Just initialize these directly.
awoloszyn 2015/02/27 22:13:54 Will do. My other patch is getting reverted for ot
awoloszyn 2015/02/27 22:13:54 Its an old habbit will fix. On that note, the CL t
47 memset(&v1, 0x0, sizeof(GeometryBindingVertex));
48 memset(&v2, 0x0, sizeof(GeometryBindingVertex));
49 memset(&v3, 0x0, sizeof(GeometryBindingVertex));
50 }
51
52 GeometryBindingQuad::GeometryBindingQuad(const GeometryBindingVertex& vert0,
53 const GeometryBindingVertex& vert1,
54 const GeometryBindingVertex& vert2,
55 const GeometryBindingVertex& vert3) {
56 v0 = vert0;
57 v1 = vert1;
58 v2 = vert2;
59 v3 = vert3;
60 }
61
62 GeometryBindingQuadIndex::GeometryBindingQuadIndex() {
63 memset(data, 0x0, sizeof(data));
64 }
65
66 GeometryBindingQuadIndex::GeometryBindingQuadIndex(uint16 index0,
67 uint16 index1,
68 uint16 index2,
69 uint16 index3,
70 uint16 index4,
71 uint16 index5) {
72 data[0] = index0;
73 data[1] = index1;
74 data[2] = index2;
75 data[3] = index3;
76 data[4] = index4;
77 data[5] = index5;
78 }
79
45 } // namespace cc 80 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698