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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/numerics/safe_conversions.h" | |
15 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
19 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
20 #include "cc/base/math_util.h" | 21 #include "cc/base/math_util.h" |
21 #include "cc/output/compositor_frame.h" | 22 #include "cc/output/compositor_frame.h" |
22 #include "cc/output/compositor_frame_metadata.h" | 23 #include "cc/output/compositor_frame_metadata.h" |
23 #include "cc/output/context_provider.h" | 24 #include "cc/output/context_provider.h" |
24 #include "cc/output/copy_output_request.h" | 25 #include "cc/output/copy_output_request.h" |
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2225 gl_->Uniform4fv(draw_cache_.background_color_location, 1, | 2226 gl_->Uniform4fv(draw_cache_.background_color_location, 1, |
2226 background_color.data); | 2227 background_color.data); |
2227 } | 2228 } |
2228 | 2229 |
2229 gl_->Uniform1fv( | 2230 gl_->Uniform1fv( |
2230 static_cast<int>(draw_cache_.vertex_opacity_location), | 2231 static_cast<int>(draw_cache_.vertex_opacity_location), |
2231 static_cast<int>(draw_cache_.vertex_opacity_data.size()), | 2232 static_cast<int>(draw_cache_.vertex_opacity_data.size()), |
2232 static_cast<float*>(&draw_cache_.vertex_opacity_data.front())); | 2233 static_cast<float*>(&draw_cache_.vertex_opacity_data.front())); |
2233 | 2234 |
2234 // Draw the quads! | 2235 // Draw the quads! |
2235 gl_->DrawElements(GL_TRIANGLES, 6 * draw_cache_.matrix_data.size(), | 2236 gl_->DrawElements(GL_TRIANGLES, |
2237 6 * base::checked_cast<int>(draw_cache_.matrix_data.size()), | |
vmpstr
2015/06/05 01:03:00
This is the only checked_cast that I'm using, most
jschuh
2015/06/05 14:08:24
Yeah, it looks like the other locations should be
danakj
2015/06/05 18:22:29
matrix_data.size() is at most 8 (line 2299). Havin
vmpstr
2015/06/05 19:27:33
Ok, I changed this to a DCHECK. I think if this is
| |
2236 GL_UNSIGNED_SHORT, 0); | 2238 GL_UNSIGNED_SHORT, 0); |
2237 | 2239 |
2238 // Clear the cache. | 2240 // Clear the cache. |
2239 draw_cache_.program_id = -1; | 2241 draw_cache_.program_id = -1; |
2240 draw_cache_.uv_xform_data.resize(0); | 2242 draw_cache_.uv_xform_data.resize(0); |
2241 draw_cache_.vertex_opacity_data.resize(0); | 2243 draw_cache_.vertex_opacity_data.resize(0); |
2242 draw_cache_.matrix_data.resize(0); | 2244 draw_cache_.matrix_data.resize(0); |
2243 | 2245 |
2244 // If we had a clipped binding, prepare the shared binding for the | 2246 // If we had a clipped binding, prepare the shared binding for the |
2245 // next inserts. | 2247 // next inserts. |
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3506 context_support_->ScheduleOverlayPlane( | 3508 context_support_->ScheduleOverlayPlane( |
3507 overlay.plane_z_order, | 3509 overlay.plane_z_order, |
3508 overlay.transform, | 3510 overlay.transform, |
3509 pending_overlay_resources_.back()->texture_id(), | 3511 pending_overlay_resources_.back()->texture_id(), |
3510 ToNearestRect(overlay.display_rect), | 3512 ToNearestRect(overlay.display_rect), |
3511 overlay.uv_rect); | 3513 overlay.uv_rect); |
3512 } | 3514 } |
3513 } | 3515 } |
3514 | 3516 |
3515 } // namespace cc | 3517 } // namespace cc |
OLD | NEW |