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

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

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed a signed vs. unsigned comparison in video_resource_updater.cc Created 7 years, 3 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.h » ('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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ++pass_iter) { 161 ++pass_iter) {
162 base::hash_map<RenderPass::Id, const RenderPass*>::const_iterator it = 162 base::hash_map<RenderPass::Id, const RenderPass*>::const_iterator it =
163 render_passes_in_frame.find(pass_iter->first); 163 render_passes_in_frame.find(pass_iter->first);
164 if (it == render_passes_in_frame.end()) { 164 if (it == render_passes_in_frame.end()) {
165 passes_to_delete.push_back(pass_iter->first); 165 passes_to_delete.push_back(pass_iter->first);
166 continue; 166 continue;
167 } 167 }
168 168
169 const RenderPass* render_pass_in_frame = it->second; 169 const RenderPass* render_pass_in_frame = it->second;
170 gfx::Size required_size = RenderPassTextureSize(render_pass_in_frame); 170 gfx::Size required_size = RenderPassTextureSize(render_pass_in_frame);
171 GLenum required_format = RenderPassTextureFormat(render_pass_in_frame); 171 ResourceFormat required_format =
172 RenderPassTextureFormat(render_pass_in_frame);
172 CachedResource* texture = pass_iter->second; 173 CachedResource* texture = pass_iter->second;
173 DCHECK(texture); 174 DCHECK(texture);
174 175
175 bool size_appropriate = texture->size().width() >= required_size.width() && 176 bool size_appropriate = texture->size().width() >= required_size.width() &&
176 texture->size().height() >= required_size.height(); 177 texture->size().height() >= required_size.height();
177 if (texture->id() && 178 if (texture->id() &&
178 (!size_appropriate || texture->format() != required_format)) 179 (!size_appropriate || texture->format() != required_format))
179 texture->Free(); 180 texture->Free();
180 } 181 }
181 182
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return false; 392 return false;
392 393
393 CachedResource* texture = render_pass_textures_.get(render_pass->id); 394 CachedResource* texture = render_pass_textures_.get(render_pass->id);
394 DCHECK(texture); 395 DCHECK(texture);
395 396
396 gfx::Size size = RenderPassTextureSize(render_pass); 397 gfx::Size size = RenderPassTextureSize(render_pass);
397 size.Enlarge(enlarge_pass_texture_amount_.x(), 398 size.Enlarge(enlarge_pass_texture_amount_.x(),
398 enlarge_pass_texture_amount_.y()); 399 enlarge_pass_texture_amount_.y());
399 if (!texture->id() && 400 if (!texture->id() &&
400 !texture->Allocate(size, 401 !texture->Allocate(size,
401 RenderPassTextureFormat(render_pass), 402 ResourceProvider::TextureUsageFramebuffer,
402 ResourceProvider::TextureUsageFramebuffer)) 403 RenderPassTextureFormat(render_pass)))
403 return false; 404 return false;
404 405
405 return BindFramebufferToTexture(frame, texture, render_pass->output_rect); 406 return BindFramebufferToTexture(frame, texture, render_pass->output_rect);
406 } 407 }
407 408
408 bool DirectRenderer::HaveCachedResourcesForRenderPassId(RenderPass::Id id) 409 bool DirectRenderer::HaveCachedResourcesForRenderPassId(RenderPass::Id id)
409 const { 410 const {
410 if (!settings_->cache_render_pass_contents) 411 if (!settings_->cache_render_pass_contents)
411 return false; 412 return false;
412 413
413 CachedResource* texture = render_pass_textures_.get(id); 414 CachedResource* texture = render_pass_textures_.get(id);
414 return texture && texture->id() && texture->is_complete(); 415 return texture && texture->id() && texture->is_complete();
415 } 416 }
416 417
417 // static 418 // static
418 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 419 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
419 return render_pass->output_rect.size(); 420 return render_pass->output_rect.size();
420 } 421 }
421 422
422 // static 423 // static
423 GLenum DirectRenderer::RenderPassTextureFormat(const RenderPass* render_pass) { 424 ResourceFormat DirectRenderer::RenderPassTextureFormat(
424 return GL_RGBA; 425 const RenderPass* render_pass) {
426 return RGBA_8888;
425 } 427 }
426 428
427 } // namespace cc 429 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698