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

Side by Side Diff: cc/picture_layer_impl.cc

Issue 12217102: cc: Avoid power of two textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Lower-case vendor. Created 7 years, 10 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/layer_tree_impl.cc ('k') | gpu/command_buffer/service/feature_info.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/picture_layer_impl.h" 5 #include "cc/picture_layer_impl.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "cc/append_quads_data.h" 8 #include "cc/append_quads_data.h"
9 #include "cc/checkerboard_draw_quad.h" 9 #include "cc/checkerboard_draw_quad.h"
10 #include "cc/debug_border_draw_quad.h" 10 #include "cc/debug_border_draw_quad.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 // If long and skinny, tile at the max untiled content size, and clamp 354 // If long and skinny, tile at the max untiled content size, and clamp
355 // the smaller dimension to the content size, e.g. 1000x12 layer with 355 // the smaller dimension to the content size, e.g. 1000x12 layer with
356 // 500x500 max untiled size would get 500x12 tiles. Also do this 356 // 500x500 max untiled size would get 500x12 tiles. Also do this
357 // if the layer is small. 357 // if the layer is small.
358 if (any_dimension_one_tile || !any_dimension_too_large) { 358 if (any_dimension_one_tile || !any_dimension_too_large) {
359 int width = 359 int width =
360 std::min(max_untiled_content_size.width(), content_bounds.width()); 360 std::min(max_untiled_content_size.width(), content_bounds.width());
361 int height = 361 int height =
362 std::min(max_untiled_content_size.height(), content_bounds.height()); 362 std::min(max_untiled_content_size.height(), content_bounds.height());
363 // Round width and height up to the closest multiple of 64. This is to 363 // Round width and height up to the closest multiple of 64, or 56 if
364 // help IMG drivers where facter of 8 texture sizes are faster, and also 364 // we should avoid power-of-two textures. This helps reduce the number
365 // to prevent creating textures of too many different size for better 365 // of different textures sizes to help recycling, and also keeps all
366 // recycling. 366 // textures multiple-of-eight, which is preferred on some drivers (IMG).
367 width = RoundUp(width, 64); 367 bool avoidPow2 = layerTreeImpl()->rendererCapabilities().avoidPow2Textures;
368 height = RoundUp(height, 64); 368 int roundUpTo = avoidPow2 ? 56 : 64;
369 width = RoundUp(width, roundUpTo);
370 height = RoundUp(height, roundUpTo);
369 return gfx::Size(width, height); 371 return gfx::Size(width, height);
370 } 372 }
371 373
372 return default_tile_size; 374 return default_tile_size;
373 } 375 }
374 376
375 void PictureLayerImpl::SyncFromActiveLayer() { 377 void PictureLayerImpl::SyncFromActiveLayer() {
376 DCHECK(layerTreeImpl()->IsPendingTree()); 378 DCHECK(layerTreeImpl()->IsPendingTree());
377 if (!drawsContent()) 379 if (!drawsContent())
378 return; 380 return;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 return twin; 715 return twin;
714 } 716 }
715 717
716 void PictureLayerImpl::getDebugBorderProperties( 718 void PictureLayerImpl::getDebugBorderProperties(
717 SkColor* color, float* width) const { 719 SkColor* color, float* width) const {
718 *color = DebugColors::TiledContentLayerBorderColor(); 720 *color = DebugColors::TiledContentLayerBorderColor();
719 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); 721 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl());
720 } 722 }
721 723
722 } // namespace cc 724 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_impl.cc ('k') | gpu/command_buffer/service/feature_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698