OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2232 Float4 background_color = PremultipliedColor(draw_cache_.background_color); | 2232 Float4 background_color = PremultipliedColor(draw_cache_.background_color); |
2233 gl_->Uniform4fv(draw_cache_.background_color_location, 1, | 2233 gl_->Uniform4fv(draw_cache_.background_color_location, 1, |
2234 background_color.data); | 2234 background_color.data); |
2235 } | 2235 } |
2236 | 2236 |
2237 gl_->Uniform1fv( | 2237 gl_->Uniform1fv( |
2238 static_cast<int>(draw_cache_.vertex_opacity_location), | 2238 static_cast<int>(draw_cache_.vertex_opacity_location), |
2239 static_cast<int>(draw_cache_.vertex_opacity_data.size()), | 2239 static_cast<int>(draw_cache_.vertex_opacity_data.size()), |
2240 static_cast<float*>(&draw_cache_.vertex_opacity_data.front())); | 2240 static_cast<float*>(&draw_cache_.vertex_opacity_data.front())); |
2241 | 2241 |
2242 DCHECK_LE(draw_cache_.matrix_data.size(), | |
2243 static_cast<size_t>(std::numeric_limits<int>::max()) / 6u); | |
2244 // Draw the quads! | 2242 // Draw the quads! |
2245 gl_->DrawElements(GL_TRIANGLES, | 2243 gl_->DrawElements(GL_TRIANGLES, 6 * draw_cache_.matrix_data.size(), |
2246 6 * static_cast<int>(draw_cache_.matrix_data.size()), | |
2247 GL_UNSIGNED_SHORT, 0); | 2244 GL_UNSIGNED_SHORT, 0); |
2248 | 2245 |
2249 // Clear the cache. | 2246 // Clear the cache. |
2250 draw_cache_.program_id = -1; | 2247 draw_cache_.program_id = -1; |
2251 draw_cache_.uv_xform_data.resize(0); | 2248 draw_cache_.uv_xform_data.resize(0); |
2252 draw_cache_.vertex_opacity_data.resize(0); | 2249 draw_cache_.vertex_opacity_data.resize(0); |
2253 draw_cache_.matrix_data.resize(0); | 2250 draw_cache_.matrix_data.resize(0); |
2254 | 2251 |
2255 // If we had a clipped binding, prepare the shared binding for the | 2252 // If we had a clipped binding, prepare the shared binding for the |
2256 // next inserts. | 2253 // next inserts. |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3523 context_support_->ScheduleOverlayPlane( | 3520 context_support_->ScheduleOverlayPlane( |
3524 overlay.plane_z_order, | 3521 overlay.plane_z_order, |
3525 overlay.transform, | 3522 overlay.transform, |
3526 pending_overlay_resources_.back()->texture_id(), | 3523 pending_overlay_resources_.back()->texture_id(), |
3527 ToNearestRect(overlay.display_rect), | 3524 ToNearestRect(overlay.display_rect), |
3528 overlay.uv_rect); | 3525 overlay.uv_rect); |
3529 } | 3526 } |
3530 } | 3527 } |
3531 | 3528 |
3532 } // namespace cc | 3529 } // namespace cc |
OLD | NEW |