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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 bool should_use_gpu_rasterization) { | 461 bool should_use_gpu_rasterization) { |
462 if (should_use_gpu_rasterization != should_use_gpu_rasterization_) { | 462 if (should_use_gpu_rasterization != should_use_gpu_rasterization_) { |
463 should_use_gpu_rasterization_ = should_use_gpu_rasterization; | 463 should_use_gpu_rasterization_ = should_use_gpu_rasterization; |
464 RemoveAllTilings(); | 464 RemoveAllTilings(); |
465 } else { | 465 } else { |
466 should_use_gpu_rasterization_ = should_use_gpu_rasterization; | 466 should_use_gpu_rasterization_ = should_use_gpu_rasterization; |
467 } | 467 } |
468 } | 468 } |
469 | 469 |
470 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, | 470 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, |
471 gfx::Rect content_rect) { | 471 const gfx::Rect& content_rect) { |
472 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) | 472 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) |
473 return scoped_refptr<Tile>(); | 473 return scoped_refptr<Tile>(); |
474 | 474 |
475 int flags = 0; | 475 int flags = 0; |
476 if (is_using_lcd_text_) | 476 if (is_using_lcd_text_) |
477 flags |= Tile::USE_LCD_TEXT; | 477 flags |= Tile::USE_LCD_TEXT; |
478 if (should_use_gpu_rasterization()) | 478 if (should_use_gpu_rasterization()) |
479 flags |= Tile::USE_GPU_RASTERIZATION; | 479 flags |= Tile::USE_GPU_RASTERIZATION; |
480 return layer_tree_impl()->tile_manager()->CreateTile( | 480 return layer_tree_impl()->tile_manager()->CreateTile( |
481 pile_.get(), | 481 pile_.get(), |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 // content. | 772 // content. |
773 MarkVisibleTilesAsRequired( | 773 MarkVisibleTilesAsRequired( |
774 low_res, twin_low_res, contents_scale_x(), rect, missing_region); | 774 low_res, twin_low_res, contents_scale_x(), rect, missing_region); |
775 } | 775 } |
776 } | 776 } |
777 | 777 |
778 bool PictureLayerImpl::MarkVisibleTilesAsRequired( | 778 bool PictureLayerImpl::MarkVisibleTilesAsRequired( |
779 PictureLayerTiling* tiling, | 779 PictureLayerTiling* tiling, |
780 const PictureLayerTiling* optional_twin_tiling, | 780 const PictureLayerTiling* optional_twin_tiling, |
781 float contents_scale, | 781 float contents_scale, |
782 gfx::Rect rect, | 782 const gfx::Rect& rect, |
783 const Region& missing_region) const { | 783 const Region& missing_region) const { |
784 bool twin_had_missing_tile = false; | 784 bool twin_had_missing_tile = false; |
785 for (PictureLayerTiling::CoverageIterator iter(tiling, | 785 for (PictureLayerTiling::CoverageIterator iter(tiling, |
786 contents_scale, | 786 contents_scale, |
787 rect); | 787 rect); |
788 iter; | 788 iter; |
789 ++iter) { | 789 ++iter) { |
790 Tile* tile = *iter; | 790 Tile* tile = *iter; |
791 // A null tile (i.e. missing recording) can just be skipped. | 791 // A null tile (i.e. missing recording) can just be skipped. |
792 if (!tile) | 792 if (!tile) |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1230 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
1231 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1231 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
1232 return tilings_->GPUMemoryUsageInBytes(); | 1232 return tilings_->GPUMemoryUsageInBytes(); |
1233 } | 1233 } |
1234 | 1234 |
1235 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1235 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1236 benchmark->RunOnLayer(this); | 1236 benchmark->RunOnLayer(this); |
1237 } | 1237 } |
1238 | 1238 |
1239 } // namespace cc | 1239 } // namespace cc |
OLD | NEW |