OLD | NEW |
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 #include <stdint.h> |
7 | 8 |
8 #include "gpu/command_buffer/tests/gl_manager.h" | 9 #include "gpu/command_buffer/tests/gl_manager.h" |
9 #include "gpu/command_buffer/tests/gl_test_utils.h" | 10 #include "gpu/command_buffer/tests/gl_test_utils.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 #define SHADER(Src) #Src | 14 #define SHADER(Src) #Src |
14 | 15 |
15 namespace gpu { | 16 namespace gpu { |
16 | 17 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 for (GLint xx = 0; xx < max_point_size; xx += point_step) { | 127 for (GLint xx = 0; xx < max_point_size; xx += point_step) { |
127 // formula for s and t from OpenGL ES 2.0 spec section 3.3 | 128 // formula for s and t from OpenGL ES 2.0 spec section 3.3 |
128 GLfloat xw = s2p(point_x); | 129 GLfloat xw = s2p(point_x); |
129 GLfloat yw = s2p(point_y); | 130 GLfloat yw = s2p(point_y); |
130 GLfloat u = xx / max_point_size * 2 - 1; | 131 GLfloat u = xx / max_point_size * 2 - 1; |
131 GLfloat v = yy / max_point_size * 2 - 1; | 132 GLfloat v = yy / max_point_size * 2 - 1; |
132 GLint xf = s2p(point_x + u * point_width); | 133 GLint xf = s2p(point_x + u * point_width); |
133 GLint yf = s2p(point_y + v * point_width); | 134 GLint yf = s2p(point_y + v * point_width); |
134 GLfloat s = 0.5 + (xf + 0.5 - xw) / max_point_size; | 135 GLfloat s = 0.5 + (xf + 0.5 - xw) / max_point_size; |
135 GLfloat t = 0.5 + (yf + 0.5 - yw) / max_point_size; | 136 GLfloat t = 0.5 + (yf + 0.5 - yw) / max_point_size; |
136 uint8 color[4] = { | 137 uint8_t color[4] = { |
137 static_cast<uint8>(s * 255), | 138 static_cast<uint8_t>(s * 255), |
138 static_cast<uint8>((1 - t) * 255), | 139 static_cast<uint8_t>((1 - t) * 255), 0, 255, |
139 0, | |
140 255, | |
141 }; | 140 }; |
142 GLTestHelper::CheckPixels(xf, yf, 1, 1, 4, color); | 141 GLTestHelper::CheckPixels(xf, yf, 1, 1, 4, color); |
143 } | 142 } |
144 } | 143 } |
145 } | 144 } |
146 } | 145 } |
147 | 146 |
148 GLTestHelper::CheckGLError("no errors", __LINE__); | 147 GLTestHelper::CheckGLError("no errors", __LINE__); |
149 } | 148 } |
150 | 149 |
151 } // namespace gpu | 150 } // namespace gpu |
152 | 151 |
153 | 152 |
154 | 153 |
OLD | NEW |