Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: cc/output/direct_renderer.cc

Issue 404563005: Make RenderPass::Id an isolated class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more case in mojo Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void DirectRenderer::SetEnlargePassTextureAmountForTesting( 141 void DirectRenderer::SetEnlargePassTextureAmountForTesting(
142 const gfx::Vector2d& amount) { 142 const gfx::Vector2d& amount) {
143 enlarge_pass_texture_amount_ = amount; 143 enlarge_pass_texture_amount_ = amount;
144 } 144 }
145 145
146 void DirectRenderer::DecideRenderPassAllocationsForFrame( 146 void DirectRenderer::DecideRenderPassAllocationsForFrame(
147 const RenderPassList& render_passes_in_draw_order) { 147 const RenderPassList& render_passes_in_draw_order) {
148 if (!resource_provider_) 148 if (!resource_provider_)
149 return; 149 return;
150 150
151 base::hash_map<RenderPass::Id, gfx::Size> render_passes_in_frame; 151 base::hash_map<RenderPassId, gfx::Size> render_passes_in_frame;
152 for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) 152 for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i)
153 render_passes_in_frame.insert(std::pair<RenderPass::Id, gfx::Size>( 153 render_passes_in_frame.insert(std::pair<RenderPassId, gfx::Size>(
154 render_passes_in_draw_order[i]->id, 154 render_passes_in_draw_order[i]->id,
155 RenderPassTextureSize(render_passes_in_draw_order[i]))); 155 RenderPassTextureSize(render_passes_in_draw_order[i])));
156 156
157 std::vector<RenderPass::Id> passes_to_delete; 157 std::vector<RenderPassId> passes_to_delete;
158 base::ScopedPtrHashMap<RenderPass::Id, ScopedResource>::const_iterator 158 base::ScopedPtrHashMap<RenderPassId, ScopedResource>::const_iterator
159 pass_iter; 159 pass_iter;
160 for (pass_iter = render_pass_textures_.begin(); 160 for (pass_iter = render_pass_textures_.begin();
161 pass_iter != render_pass_textures_.end(); 161 pass_iter != render_pass_textures_.end();
162 ++pass_iter) { 162 ++pass_iter) {
163 base::hash_map<RenderPass::Id, gfx::Size>::const_iterator it = 163 base::hash_map<RenderPassId, gfx::Size>::const_iterator it =
164 render_passes_in_frame.find(pass_iter->first); 164 render_passes_in_frame.find(pass_iter->first);
165 if (it == render_passes_in_frame.end()) { 165 if (it == render_passes_in_frame.end()) {
166 passes_to_delete.push_back(pass_iter->first); 166 passes_to_delete.push_back(pass_iter->first);
167 continue; 167 continue;
168 } 168 }
169 169
170 gfx::Size required_size = it->second; 170 gfx::Size required_size = it->second;
171 ScopedResource* texture = pass_iter->second; 171 ScopedResource* texture = pass_iter->second;
172 DCHECK(texture); 172 DCHECK(texture);
173 173
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 size.Enlarge(enlarge_pass_texture_amount_.x(), 408 size.Enlarge(enlarge_pass_texture_amount_.x(),
409 enlarge_pass_texture_amount_.y()); 409 enlarge_pass_texture_amount_.y());
410 if (!texture->id()) 410 if (!texture->id())
411 texture->Allocate( 411 texture->Allocate(
412 size, ResourceProvider::TextureUsageFramebuffer, RGBA_8888); 412 size, ResourceProvider::TextureUsageFramebuffer, RGBA_8888);
413 DCHECK(texture->id()); 413 DCHECK(texture->id());
414 414
415 return BindFramebufferToTexture(frame, texture, render_pass->output_rect); 415 return BindFramebufferToTexture(frame, texture, render_pass->output_rect);
416 } 416 }
417 417
418 bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPass::Id id) 418 bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPassId id) const {
419 const {
420 ScopedResource* texture = render_pass_textures_.get(id); 419 ScopedResource* texture = render_pass_textures_.get(id);
421 return texture && texture->id(); 420 return texture && texture->id();
422 } 421 }
423 422
424 // static 423 // static
425 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 424 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
426 return render_pass->output_rect.size(); 425 return render_pass->output_rect.size();
427 } 426 }
428 427
429 } // namespace cc 428 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698