OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/output/direct_renderer.h" | 5 #include "cc/output/direct_renderer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/containers/scoped_ptr_hash_map.h" | 11 #include "base/containers/scoped_ptr_hash_map.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/numerics/safe_conversions.h" | |
14 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
15 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
16 #include "cc/output/bsp_tree.h" | 15 #include "cc/output/bsp_tree.h" |
17 #include "cc/output/bsp_walk_action.h" | 16 #include "cc/output/bsp_walk_action.h" |
18 #include "cc/output/copy_output_request.h" | 17 #include "cc/output/copy_output_request.h" |
19 #include "cc/quads/draw_quad.h" | 18 #include "cc/quads/draw_quad.h" |
20 #include "ui/gfx/geometry/rect_conversions.h" | 19 #include "ui/gfx/geometry/rect_conversions.h" |
21 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
22 | 21 |
23 static gfx::Transform OrthoProjectionMatrix(float left, | 22 static gfx::Transform OrthoProjectionMatrix(float left, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 186 } |
188 } | 187 } |
189 } | 188 } |
190 | 189 |
191 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, | 190 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, |
192 float device_scale_factor, | 191 float device_scale_factor, |
193 const gfx::Rect& device_viewport_rect, | 192 const gfx::Rect& device_viewport_rect, |
194 const gfx::Rect& device_clip_rect, | 193 const gfx::Rect& device_clip_rect, |
195 bool disable_picture_quad_image_filtering) { | 194 bool disable_picture_quad_image_filtering) { |
196 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); | 195 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); |
197 UMA_HISTOGRAM_COUNTS( | 196 UMA_HISTOGRAM_COUNTS("Renderer4.renderPassCount", |
198 "Renderer4.renderPassCount", | 197 render_passes_in_draw_order->size()); |
199 base::saturated_cast<int>(render_passes_in_draw_order->size())); | |
200 | 198 |
201 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); | 199 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); |
202 DCHECK(root_render_pass); | 200 DCHECK(root_render_pass); |
203 | 201 |
204 DrawingFrame frame; | 202 DrawingFrame frame; |
205 frame.render_passes_in_draw_order = render_passes_in_draw_order; | 203 frame.render_passes_in_draw_order = render_passes_in_draw_order; |
206 frame.root_render_pass = root_render_pass; | 204 frame.root_render_pass = root_render_pass; |
207 frame.root_damage_rect = Capabilities().using_partial_swap | 205 frame.root_damage_rect = Capabilities().using_partial_swap |
208 ? root_render_pass->damage_rect | 206 ? root_render_pass->damage_rect |
209 : root_render_pass->output_rect; | 207 : root_render_pass->output_rect; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 ScopedResource* texture = render_pass_textures_.get(id); | 520 ScopedResource* texture = render_pass_textures_.get(id); |
523 return texture && texture->id(); | 521 return texture && texture->id(); |
524 } | 522 } |
525 | 523 |
526 // static | 524 // static |
527 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 525 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
528 return render_pass->output_rect.size(); | 526 return render_pass->output_rect.size(); |
529 } | 527 } |
530 | 528 |
531 } // namespace cc | 529 } // namespace cc |
OLD | NEW |