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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |