| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (const TileDrawQuad* tile_quad = CanPassBeDrawnDirectly(pass.get())) { | 185 if (const TileDrawQuad* tile_quad = CanPassBeDrawnDirectly(pass.get())) { |
| 186 // If the render pass is drawn directly, it will not be drawn from as | 186 // If the render pass is drawn directly, it will not be drawn from as |
| 187 // a render pass so it's not added to the map. | 187 // a render pass so it's not added to the map. |
| 188 render_pass_bypass_quads_[pass->id] = *tile_quad; | 188 render_pass_bypass_quads_[pass->id] = *tile_quad; |
| 189 continue; | 189 continue; |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 render_passes_in_frame[pass->id] = RenderPassTextureSize(pass.get()); | 192 render_passes_in_frame[pass->id] = RenderPassTextureSize(pass.get()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 std::vector<int> passes_to_delete; | 195 std::vector<RenderPassId> passes_to_delete; |
| 196 for (const auto& pair : render_pass_textures_) { | 196 for (const auto& pair : render_pass_textures_) { |
| 197 auto it = render_passes_in_frame.find(pair.first); | 197 auto it = render_passes_in_frame.find(pair.first); |
| 198 if (it == render_passes_in_frame.end()) { | 198 if (it == render_passes_in_frame.end()) { |
| 199 passes_to_delete.push_back(pair.first); | 199 passes_to_delete.push_back(pair.first); |
| 200 continue; | 200 continue; |
| 201 } | 201 } |
| 202 | 202 |
| 203 gfx::Size required_size = it->second; | 203 gfx::Size required_size = it->second; |
| 204 ScopedResource* texture = pair.second.get(); | 204 ScopedResource* texture = pair.second.get(); |
| 205 DCHECK(texture); | 205 DCHECK(texture); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 if (BindFramebufferToTexture(texture)) { | 630 if (BindFramebufferToTexture(texture)) { |
| 631 InitializeViewport(current_frame(), render_pass->output_rect, | 631 InitializeViewport(current_frame(), render_pass->output_rect, |
| 632 gfx::Rect(render_pass->output_rect.size()), | 632 gfx::Rect(render_pass->output_rect.size()), |
| 633 texture->size()); | 633 texture->size()); |
| 634 return true; | 634 return true; |
| 635 } | 635 } |
| 636 | 636 |
| 637 return false; | 637 return false; |
| 638 } | 638 } |
| 639 | 639 |
| 640 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const { | 640 bool DirectRenderer::HasAllocatedResourcesForTesting( |
| 641 RenderPassId render_pass_id) const { |
| 641 auto iter = render_pass_textures_.find(render_pass_id); | 642 auto iter = render_pass_textures_.find(render_pass_id); |
| 642 return iter != render_pass_textures_.end() && iter->second->id(); | 643 return iter != render_pass_textures_.end() && iter->second->id(); |
| 643 } | 644 } |
| 644 | 645 |
| 645 // static | 646 // static |
| 646 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 647 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 647 return render_pass->output_rect.size(); | 648 return render_pass->output_rect.size(); |
| 648 } | 649 } |
| 649 | 650 |
| 650 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { | 651 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { |
| 651 current_frame_valid_ = true; | 652 current_frame_valid_ = true; |
| 652 current_frame_ = frame; | 653 current_frame_ = frame; |
| 653 } | 654 } |
| 654 | 655 |
| 655 } // namespace cc | 656 } // namespace cc |
| OLD | NEW |