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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 ideal_contents_scale_(0.f), | 47 ideal_contents_scale_(0.f), |
48 raster_page_scale_(0.f), | 48 raster_page_scale_(0.f), |
49 raster_device_scale_(0.f), | 49 raster_device_scale_(0.f), |
50 raster_source_scale_(0.f), | 50 raster_source_scale_(0.f), |
51 raster_contents_scale_(0.f), | 51 raster_contents_scale_(0.f), |
52 low_res_raster_contents_scale_(0.f), | 52 low_res_raster_contents_scale_(0.f), |
53 raster_source_scale_was_animating_(false), | 53 raster_source_scale_was_animating_(false), |
54 is_using_lcd_text_(tree_impl->settings().can_use_lcd_text), | 54 is_using_lcd_text_(tree_impl->settings().can_use_lcd_text), |
55 needs_post_commit_initialization_(true), | 55 needs_post_commit_initialization_(true), |
56 should_update_tile_priorities_(false), | 56 should_update_tile_priorities_(false), |
57 has_gpu_rasterization_hint_(false) {} | 57 has_gpu_rasterization_hint_(false), |
| 58 should_use_low_res_tiling_(tree_impl->settings().create_low_res_tiling) {} |
58 | 59 |
59 PictureLayerImpl::~PictureLayerImpl() {} | 60 PictureLayerImpl::~PictureLayerImpl() {} |
60 | 61 |
61 const char* PictureLayerImpl::LayerTypeAsString() const { | 62 const char* PictureLayerImpl::LayerTypeAsString() const { |
62 return "cc::PictureLayerImpl"; | 63 return "cc::PictureLayerImpl"; |
63 } | 64 } |
64 | 65 |
65 scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( | 66 scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( |
66 LayerTreeImpl* tree_impl) { | 67 LayerTreeImpl* tree_impl) { |
67 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 68 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale)); | 462 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale)); |
462 } | 463 } |
463 | 464 |
464 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 465 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
465 return pile_->GetFlattenedPicture(); | 466 return pile_->GetFlattenedPicture(); |
466 } | 467 } |
467 | 468 |
468 void PictureLayerImpl::SetHasGpuRasterizationHint(bool has_hint) { | 469 void PictureLayerImpl::SetHasGpuRasterizationHint(bool has_hint) { |
469 bool old_should_use_gpu_rasterization = ShouldUseGpuRasterization(); | 470 bool old_should_use_gpu_rasterization = ShouldUseGpuRasterization(); |
470 has_gpu_rasterization_hint_ = has_hint; | 471 has_gpu_rasterization_hint_ = has_hint; |
| 472 if (has_gpu_rasterization_hint_) |
| 473 should_use_low_res_tiling_ = false; |
471 if (ShouldUseGpuRasterization() != old_should_use_gpu_rasterization) | 474 if (ShouldUseGpuRasterization() != old_should_use_gpu_rasterization) |
472 RemoveAllTilings(); | 475 RemoveAllTilings(); |
473 } | 476 } |
474 | 477 |
475 bool PictureLayerImpl::ShouldUseGpuRasterization() const { | 478 bool PictureLayerImpl::ShouldUseGpuRasterization() const { |
476 switch (layer_tree_impl()->settings().rasterization_site) { | 479 switch (layer_tree_impl()->settings().rasterization_site) { |
477 case LayerTreeSettings::CpuRasterization: | 480 case LayerTreeSettings::CpuRasterization: |
478 return false; | 481 return false; |
479 case LayerTreeSettings::HybridRasterization: | 482 case LayerTreeSettings::HybridRasterization: |
480 return has_gpu_rasterization_hint_; | 483 return has_gpu_rasterization_hint_; |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1252 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
1250 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1253 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
1251 return tilings_->GPUMemoryUsageInBytes(); | 1254 return tilings_->GPUMemoryUsageInBytes(); |
1252 } | 1255 } |
1253 | 1256 |
1254 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1257 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1255 benchmark->RunOnLayer(this); | 1258 benchmark->RunOnLayer(this); |
1256 } | 1259 } |
1257 | 1260 |
1258 } // namespace cc | 1261 } // namespace cc |
OLD | NEW |