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/debug/devtools_instrumentation.h" | 7 #include "cc/debug/devtools_instrumentation.h" |
8 #include "cc/layers/picture_layer_impl.h" | 8 #include "cc/layers/picture_layer_impl.h" |
9 #include "cc/trees/layer_tree_impl.h" | 9 #include "cc/trees/layer_tree_impl.h" |
10 #include "ui/gfx/rect_conversions.h" | 10 #include "ui/gfx/rect_conversions.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 33 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
34 } | 34 } |
35 | 35 |
36 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { | 36 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { |
37 Layer::PushPropertiesTo(base_layer); | 37 Layer::PushPropertiesTo(base_layer); |
38 | 38 |
39 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 39 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
40 layer_impl->SetIsMask(is_mask_); | 40 layer_impl->SetIsMask(is_mask_); |
41 layer_impl->CreateTilingSet(); | 41 layer_impl->CreateTilingSet(); |
42 layer_impl->invalidation_.Clear(); | 42 layer_impl->invalidation_.Clear(); |
43 layer_impl->invalidation_.Swap(pile_invalidation_); | 43 layer_impl->invalidation_.Swap(&pile_invalidation_); |
44 layer_impl->pile_ = | 44 layer_impl->pile_ = |
45 PicturePileImpl::CreateFromOther(pile_, layer_impl->is_using_lcd_text_); | 45 PicturePileImpl::CreateFromOther(pile_, layer_impl->is_using_lcd_text_); |
46 layer_impl->SyncFromActiveLayer(); | 46 layer_impl->SyncFromActiveLayer(); |
47 } | 47 } |
48 | 48 |
49 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 49 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
50 Layer::SetLayerTreeHost(host); | 50 Layer::SetLayerTreeHost(host); |
51 if (host) { | 51 if (host) { |
52 pile_->SetMinContentsScale(host->settings().minimum_contents_scale); | 52 pile_->SetMinContentsScale(host->settings().minimum_contents_scale); |
53 pile_->SetTileGridSize(host->settings().default_tile_size); | 53 pile_->SetTileGridSize(host->settings().default_tile_size); |
(...skipping 16 matching lines...) Expand all Loading... |
70 void PictureLayer::Update(ResourceUpdateQueue*, | 70 void PictureLayer::Update(ResourceUpdateQueue*, |
71 const OcclusionTracker*, | 71 const OcclusionTracker*, |
72 RenderingStats* stats) { | 72 RenderingStats* stats) { |
73 // Do not early-out of this function so that PicturePile::Update has a chance | 73 // Do not early-out of this function so that PicturePile::Update has a chance |
74 // to record pictures due to changing visibility of this layer. | 74 // to record pictures due to changing visibility of this layer. |
75 | 75 |
76 pile_->Resize(bounds()); | 76 pile_->Resize(bounds()); |
77 | 77 |
78 // Calling paint in WebKit can sometimes cause invalidations, so save | 78 // Calling paint in WebKit can sometimes cause invalidations, so save |
79 // off the invalidation prior to calling update. | 79 // off the invalidation prior to calling update. |
80 pile_invalidation_.Swap(pending_invalidation_); | 80 pile_invalidation_.Swap(&pending_invalidation_); |
81 pending_invalidation_.Clear(); | 81 pending_invalidation_.Clear(); |
82 | 82 |
83 gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( | 83 gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( |
84 gfx::ScaleRect(visible_content_rect(), 1.f / contents_scale_x())); | 84 gfx::ScaleRect(visible_content_rect(), 1.f / contents_scale_x())); |
85 devtools_instrumentation::ScopedPaintLayer paint_layer(id()); | 85 devtools_instrumentation::ScopedPaintLayer paint_layer(id()); |
86 pile_->Update(client_, | 86 pile_->Update(client_, |
87 background_color(), | 87 background_color(), |
88 pile_invalidation_, | 88 pile_invalidation_, |
89 visible_layer_rect, | 89 visible_layer_rect, |
90 stats); | 90 stats); |
91 } | 91 } |
92 | 92 |
93 void PictureLayer::SetIsMask(bool is_mask) { | 93 void PictureLayer::SetIsMask(bool is_mask) { |
94 is_mask_ = is_mask; | 94 is_mask_ = is_mask; |
95 } | 95 } |
96 | 96 |
97 } // namespace cc | 97 } // namespace cc |
OLD | NEW |