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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
10 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (host) { | 61 if (host) { |
62 pile_->SetMinContentsScale(host->settings().minimum_contents_scale); | 62 pile_->SetMinContentsScale(host->settings().minimum_contents_scale); |
63 pile_->SetTileGridSize(host->settings().default_tile_size); | 63 pile_->SetTileGridSize(host->settings().default_tile_size); |
64 pile_->set_slow_down_raster_scale_factor( | 64 pile_->set_slow_down_raster_scale_factor( |
65 host->debug_state().slow_down_raster_scale_factor); | 65 host->debug_state().slow_down_raster_scale_factor); |
66 pile_->set_show_debug_picture_borders( | 66 pile_->set_show_debug_picture_borders( |
67 host->debug_state().show_picture_borders); | 67 host->debug_state().show_picture_borders); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 void PictureLayer::SetNeedsDisplayRect(const gfx::RectF& layer_rect) { | 71 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { |
72 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); | 72 if (!layer_rect.IsEmpty()) { |
73 if (!rect.IsEmpty()) { | |
74 // Clamp invalidation to the layer bounds. | 73 // Clamp invalidation to the layer bounds. |
75 rect.Intersect(gfx::Rect(bounds())); | 74 pending_invalidation_.Union( |
76 pending_invalidation_.Union(rect); | 75 gfx::IntersectRects(layer_rect, gfx::Rect(bounds()))); |
77 } | 76 } |
78 Layer::SetNeedsDisplayRect(layer_rect); | 77 Layer::SetNeedsDisplayRect(layer_rect); |
79 } | 78 } |
80 | 79 |
81 bool PictureLayer::Update(ResourceUpdateQueue* queue, | 80 bool PictureLayer::Update(ResourceUpdateQueue* queue, |
82 const OcclusionTracker<Layer>* occlusion) { | 81 const OcclusionTracker<Layer>* occlusion) { |
83 update_source_frame_number_ = layer_tree_host()->source_frame_number(); | 82 update_source_frame_number_ = layer_tree_host()->source_frame_number(); |
84 bool updated = Layer::Update(queue, occlusion); | 83 bool updated = Layer::Update(queue, occlusion); |
85 | 84 |
86 { | 85 { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 202 |
204 bool PictureLayer::HasDrawableContent() const { | 203 bool PictureLayer::HasDrawableContent() const { |
205 return client_ && Layer::HasDrawableContent(); | 204 return client_ && Layer::HasDrawableContent(); |
206 } | 205 } |
207 | 206 |
208 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 207 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
209 benchmark->RunOnLayer(this); | 208 benchmark->RunOnLayer(this); |
210 } | 209 } |
211 | 210 |
212 } // namespace cc | 211 } // namespace cc |
OLD | NEW |