Chromium Code Reviews| 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 | 461 |
| 462 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 462 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
| 463 return pile_->GetFlattenedPicture(); | 463 return pile_->GetFlattenedPicture(); |
| 464 } | 464 } |
| 465 | 465 |
| 466 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, | 466 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, |
| 467 gfx::Rect content_rect) { | 467 gfx::Rect content_rect) { |
| 468 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) | 468 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) |
| 469 return scoped_refptr<Tile>(); | 469 return scoped_refptr<Tile>(); |
| 470 | 470 |
| 471 // TODO(skaslev): Add a proper heuristic for hybrid (software or GPU) | |
| 472 // tile rasterization. Currently, when --enable-gpu-rasterization is | |
| 473 // set all tiles get GPU rasterized. | |
| 474 bool use_gpu_rasterizer = | |
|
nduca
2013/12/02 19:50:17
Can you make this a function call please, up front
slavi
2013/12/04 02:06:50
Done.
| |
| 475 layer_tree_impl()->settings().using_gpu_rasterization; | |
| 471 return layer_tree_impl()->tile_manager()->CreateTile( | 476 return layer_tree_impl()->tile_manager()->CreateTile( |
| 472 pile_.get(), | 477 pile_.get(), |
| 473 content_rect.size(), | 478 content_rect.size(), |
| 474 content_rect, | 479 content_rect, |
| 475 contents_opaque() ? content_rect : gfx::Rect(), | 480 contents_opaque() ? content_rect : gfx::Rect(), |
| 476 tiling->contents_scale(), | 481 tiling->contents_scale(), |
| 477 id(), | 482 id(), |
| 478 layer_tree_impl()->source_frame_number(), | 483 layer_tree_impl()->source_frame_number(), |
| 479 is_using_lcd_text_); | 484 is_using_lcd_text_, |
| 485 use_gpu_rasterizer); | |
| 480 } | 486 } |
| 481 | 487 |
| 482 void PictureLayerImpl::UpdatePile(Tile* tile) { | 488 void PictureLayerImpl::UpdatePile(Tile* tile) { |
| 483 tile->set_picture_pile(pile_); | 489 tile->set_picture_pile(pile_); |
| 484 } | 490 } |
| 485 | 491 |
| 486 const Region* PictureLayerImpl::GetInvalidation() { | 492 const Region* PictureLayerImpl::GetInvalidation() { |
| 487 return &invalidation_; | 493 return &invalidation_; |
| 488 } | 494 } |
| 489 | 495 |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1207 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1213 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
| 1208 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1214 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
| 1209 return tilings_->GPUMemoryUsageInBytes(); | 1215 return tilings_->GPUMemoryUsageInBytes(); |
| 1210 } | 1216 } |
| 1211 | 1217 |
| 1212 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1218 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1213 benchmark->RunOnLayer(this); | 1219 benchmark->RunOnLayer(this); |
| 1214 } | 1220 } |
| 1215 | 1221 |
| 1216 } // namespace cc | 1222 } // namespace cc |
| OLD | NEW |