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.h" | 5 #include "cc/layers/picture_layer.h" |
6 | 6 |
| 7 #include "cc/base/switches.h" |
7 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
8 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
9 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
10 #include "ui/gfx/rect_conversions.h" | 11 #include "ui/gfx/rect_conversions.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { | 15 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { |
15 return make_scoped_refptr(new PictureLayer(client)); | 16 return make_scoped_refptr(new PictureLayer(client)); |
16 } | 17 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 layer_impl->invalidation_.Clear(); | 57 layer_impl->invalidation_.Clear(); |
57 layer_impl->invalidation_.Swap(&pile_invalidation_); | 58 layer_impl->invalidation_.Swap(&pile_invalidation_); |
58 layer_impl->pile_ = PicturePileImpl::CreateFromOther(pile_.get()); | 59 layer_impl->pile_ = PicturePileImpl::CreateFromOther(pile_.get()); |
59 } | 60 } |
60 | 61 |
61 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 62 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
62 Layer::SetLayerTreeHost(host); | 63 Layer::SetLayerTreeHost(host); |
63 if (host) { | 64 if (host) { |
64 pile_->SetMinContentsScale(host->settings().minimum_contents_scale); | 65 pile_->SetMinContentsScale(host->settings().minimum_contents_scale); |
65 pile_->SetTileGridSize(host->settings().default_tile_size); | 66 pile_->SetTileGridSize(host->settings().default_tile_size); |
66 pile_->set_num_raster_threads(host->settings().num_raster_threads); | 67 pile_->set_num_raster_threads(switches::GetNumRasterThreads()); |
67 pile_->set_slow_down_raster_scale_factor( | 68 pile_->set_slow_down_raster_scale_factor( |
68 host->debug_state().slow_down_raster_scale_factor); | 69 host->debug_state().slow_down_raster_scale_factor); |
69 pile_->set_show_debug_picture_borders( | 70 pile_->set_show_debug_picture_borders( |
70 host->debug_state().show_picture_borders); | 71 host->debug_state().show_picture_borders); |
71 } | 72 } |
72 } | 73 } |
73 | 74 |
74 void PictureLayer::SetNeedsDisplayRect(const gfx::RectF& layer_rect) { | 75 void PictureLayer::SetNeedsDisplayRect(const gfx::RectF& layer_rect) { |
75 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); | 76 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); |
76 if (!rect.IsEmpty()) { | 77 if (!rect.IsEmpty()) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); | 156 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); |
156 picture->endRecording(); | 157 picture->endRecording(); |
157 return picture; | 158 return picture; |
158 } | 159 } |
159 | 160 |
160 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 161 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
161 benchmark->RunOnLayer(this); | 162 benchmark->RunOnLayer(this); |
162 } | 163 } |
163 | 164 |
164 } // namespace cc | 165 } // namespace cc |
OLD | NEW |