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

Side by Side Diff: gpu/command_buffer/tests/gl_pointcoord_unittest.cc

Issue 11568033: Small fixes to allow unit tests to compile with gcc 4.7.x (tested with gcc 4.7.2) (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h> 6 #include <GLES2/gl2ext.h>
7 7
8 #include "gpu/command_buffer/tests/gl_manager.h" 8 #include "gpu/command_buffer/tests/gl_manager.h"
9 #include "gpu/command_buffer/tests/gl_test_utils.h" 9 #include "gpu/command_buffer/tests/gl_test_utils.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 22 matching lines...) Expand all
33 33
34 GLManager gl_; 34 GLManager gl_;
35 }; 35 };
36 36
37 GLuint PointCoordTest::SetupQuad( 37 GLuint PointCoordTest::SetupQuad(
38 GLint position_location, GLfloat pixel_offset) { 38 GLint position_location, GLfloat pixel_offset) {
39 GLuint vbo = 0; 39 GLuint vbo = 0;
40 glGenBuffers(1, &vbo); 40 glGenBuffers(1, &vbo);
41 glBindBuffer(GL_ARRAY_BUFFER, vbo); 41 glBindBuffer(GL_ARRAY_BUFFER, vbo);
42 float vertices[] = { 42 float vertices[] = {
43 -0.5 + pixel_offset, -0.5 + pixel_offset, 43 -0.5f + pixel_offset, -0.5f + pixel_offset,
44 0.5 + pixel_offset, -0.5 + pixel_offset, 44 0.5f + pixel_offset, -0.5f + pixel_offset,
45 -0.5 + pixel_offset, 0.5 + pixel_offset, 45 -0.5f + pixel_offset, 0.5f + pixel_offset,
46 0.5 + pixel_offset, 0.5 + pixel_offset, 46 0.5f + pixel_offset, 0.5f + pixel_offset,
47 }; 47 };
48 glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); 48 glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
49 glEnableVertexAttribArray(position_location); 49 glEnableVertexAttribArray(position_location);
50 glVertexAttribPointer(position_location, 2, GL_FLOAT, GL_FALSE, 0, 0); 50 glVertexAttribPointer(position_location, 2, GL_FLOAT, GL_FALSE, 0, 0);
51 51
52 return vbo; 52 return vbo;
53 } 53 }
54 54
55 namespace { 55 namespace {
56 56
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // formula for s and t from OpenGL ES 2.0 spec section 3.3 129 // formula for s and t from OpenGL ES 2.0 spec section 3.3
130 GLfloat xw = s2p(point_x); 130 GLfloat xw = s2p(point_x);
131 GLfloat yw = s2p(point_y); 131 GLfloat yw = s2p(point_y);
132 GLfloat u = xx / max_point_size * 2 - 1; 132 GLfloat u = xx / max_point_size * 2 - 1;
133 GLfloat v = yy / max_point_size * 2 - 1; 133 GLfloat v = yy / max_point_size * 2 - 1;
134 GLint xf = s2p(point_x + u * point_width); 134 GLint xf = s2p(point_x + u * point_width);
135 GLint yf = s2p(point_y + v * point_width); 135 GLint yf = s2p(point_y + v * point_width);
136 GLfloat s = 0.5 + (xf + 0.5 - xw) / max_point_size; 136 GLfloat s = 0.5 + (xf + 0.5 - xw) / max_point_size;
137 GLfloat t = 0.5 + (yf + 0.5 - yw) / max_point_size; 137 GLfloat t = 0.5 + (yf + 0.5 - yw) / max_point_size;
138 uint8 color[4] = { 138 uint8 color[4] = {
139 s * 255, 139 static_cast<uint8>(s * 255),
140 (1 - t) * 255, 140 static_cast<uint8>((1 - t) * 255),
141 0, 141 0,
142 255, 142 255,
143 }; 143 };
144 GLTestHelper::CheckPixels(xf, yf, 1, 1, 4, color); 144 GLTestHelper::CheckPixels(xf, yf, 1, 1, 4, color);
145 } 145 }
146 } 146 }
147 } 147 }
148 } 148 }
149 149
150 GLTestHelper::CheckGLError("no errors", __LINE__); 150 GLTestHelper::CheckGLError("no errors", __LINE__);
151 } 151 }
152 152
153 } // namespace gpu 153 } // namespace gpu
154 154
155 155
156 156
OLDNEW
« no previous file with comments | « chrome/browser/predictors/autocomplete_action_predictor_unittest.cc ('k') | net/base/x509_util_nss_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698