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" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 void DirectRenderer::DecideRenderPassAllocationsForFrame( | 147 void DirectRenderer::DecideRenderPassAllocationsForFrame( |
148 const RenderPassList& render_passes_in_draw_order) { | 148 const RenderPassList& render_passes_in_draw_order) { |
149 base::hash_map<RenderPassId, gfx::Size> render_passes_in_frame; | 149 base::hash_map<RenderPassId, gfx::Size> render_passes_in_frame; |
150 for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) | 150 for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) |
151 render_passes_in_frame.insert(std::pair<RenderPassId, gfx::Size>( | 151 render_passes_in_frame.insert(std::pair<RenderPassId, gfx::Size>( |
152 render_passes_in_draw_order[i]->id, | 152 render_passes_in_draw_order[i]->id, |
153 RenderPassTextureSize(render_passes_in_draw_order[i]))); | 153 RenderPassTextureSize(render_passes_in_draw_order[i]))); |
154 | 154 |
155 std::vector<RenderPassId> passes_to_delete; | 155 std::vector<RenderPassId> passes_to_delete; |
156 base::ScopedPtrHashMap<RenderPassId, ScopedResource>::const_iterator | 156 for (auto pass_iter = render_pass_textures_.begin(); |
157 pass_iter; | 157 pass_iter != render_pass_textures_.end(); ++pass_iter) { |
158 for (pass_iter = render_pass_textures_.begin(); | |
159 pass_iter != render_pass_textures_.end(); | |
160 ++pass_iter) { | |
161 base::hash_map<RenderPassId, gfx::Size>::const_iterator it = | 158 base::hash_map<RenderPassId, gfx::Size>::const_iterator it = |
162 render_passes_in_frame.find(pass_iter->first); | 159 render_passes_in_frame.find(pass_iter->first); |
163 if (it == render_passes_in_frame.end()) { | 160 if (it == render_passes_in_frame.end()) { |
164 passes_to_delete.push_back(pass_iter->first); | 161 passes_to_delete.push_back(pass_iter->first); |
165 continue; | 162 continue; |
166 } | 163 } |
167 | 164 |
168 gfx::Size required_size = it->second; | 165 gfx::Size required_size = it->second; |
169 ScopedResource* texture = pass_iter->second; | 166 ScopedResource* texture = pass_iter->second; |
170 DCHECK(texture); | 167 DCHECK(texture); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 ScopedResource* texture = render_pass_textures_.get(id); | 517 ScopedResource* texture = render_pass_textures_.get(id); |
521 return texture && texture->id(); | 518 return texture && texture->id(); |
522 } | 519 } |
523 | 520 |
524 // static | 521 // static |
525 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 522 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
526 return render_pass->output_rect.size(); | 523 return render_pass->output_rect.size(); |
527 } | 524 } |
528 | 525 |
529 } // namespace cc | 526 } // namespace cc |
OLD | NEW |