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/picture_layer.h" | 5 #include "cc/picture_layer.h" |
6 | 6 |
7 #include "cc/layer_tree_impl.h" | 7 #include "cc/layer_tree_impl.h" |
8 #include "cc/picture_layer_impl.h" | 8 #include "cc/picture_layer_impl.h" |
9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 36 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
37 layer_impl->SetIsMask(is_mask_); | 37 layer_impl->SetIsMask(is_mask_); |
38 layer_impl->tilings_.SetLayerBounds(bounds()); | 38 layer_impl->tilings_.SetLayerBounds(bounds()); |
39 layer_impl->invalidation_.Clear(); | 39 layer_impl->invalidation_.Clear(); |
40 layer_impl->invalidation_.Swap(pile_invalidation_); | 40 layer_impl->invalidation_.Swap(pile_invalidation_); |
41 pile_.PushPropertiesTo(layer_impl->pile_); | 41 pile_.PushPropertiesTo(layer_impl->pile_); |
42 | 42 |
43 layer_impl->SyncFromActiveLayer(); | 43 layer_impl->SyncFromActiveLayer(); |
44 } | 44 } |
45 | 45 |
| 46 void PictureLayer::setLayerTreeHost(LayerTreeHost* host) { |
| 47 Layer::setLayerTreeHost(host); |
| 48 if (host) |
| 49 pile_.SetMinContentsScale(host->settings().minimumContentsScale); |
| 50 } |
| 51 |
46 void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) { | 52 void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) { |
47 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); | 53 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); |
48 pending_invalidation_.Union(rect); | 54 pending_invalidation_.Union(rect); |
49 Layer::setNeedsDisplayRect(layer_rect); | 55 Layer::setNeedsDisplayRect(layer_rect); |
50 } | 56 } |
51 | 57 |
52 void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, | 58 void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, |
53 RenderingStats& stats) { | 59 RenderingStats& stats) { |
54 if (pile_.size() == bounds() && pending_invalidation_.IsEmpty()) | 60 if (pile_.size() == bounds() && pending_invalidation_.IsEmpty()) |
55 return; | 61 return; |
56 | 62 |
57 pile_.Resize(bounds()); | 63 pile_.Resize(bounds()); |
58 | 64 |
59 // Calling paint in WebKit can sometimes cause invalidations, so save | 65 // Calling paint in WebKit can sometimes cause invalidations, so save |
60 // off the invalidation prior to calling update. | 66 // off the invalidation prior to calling update. |
61 pile_invalidation_.Swap(pending_invalidation_); | 67 pile_invalidation_.Swap(pending_invalidation_); |
62 pending_invalidation_.Clear(); | 68 pending_invalidation_.Clear(); |
63 | 69 |
64 pile_.Update(client_, pile_invalidation_, stats); | 70 pile_.Update(client_, pile_invalidation_, stats); |
65 } | 71 } |
66 | 72 |
67 void PictureLayer::setIsMask(bool is_mask) { | 73 void PictureLayer::setIsMask(bool is_mask) { |
68 is_mask_ = is_mask; | 74 is_mask_ = is_mask; |
69 } | 75 } |
70 | 76 |
71 } // namespace cc | 77 } // namespace cc |
OLD | NEW |