| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); | 61 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); |
| 62 if (!rect.IsEmpty()) { | 62 if (!rect.IsEmpty()) { |
| 63 // Clamp invalidation to the layer bounds. | 63 // Clamp invalidation to the layer bounds. |
| 64 rect.Intersect(gfx::Rect(bounds())); | 64 rect.Intersect(gfx::Rect(bounds())); |
| 65 pending_invalidation_.Union(rect); | 65 pending_invalidation_.Union(rect); |
| 66 } | 66 } |
| 67 Layer::SetNeedsDisplayRect(layer_rect); | 67 Layer::SetNeedsDisplayRect(layer_rect); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void PictureLayer::Update(ResourceUpdateQueue*, | 70 void PictureLayer::Update(ResourceUpdateQueue*, |
| 71 const OcclusionTracker*, | 71 const OcclusionTracker*) { |
| 72 RenderingStats* stats) { | |
| 73 // Do not early-out of this function so that PicturePile::Update has a chance | 72 // 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. | 73 // to record pictures due to changing visibility of this layer. |
| 75 | 74 |
| 76 pile_->Resize(bounds()); | 75 pile_->Resize(bounds()); |
| 77 | 76 |
| 78 // Calling paint in WebKit can sometimes cause invalidations, so save | 77 // Calling paint in WebKit can sometimes cause invalidations, so save |
| 79 // off the invalidation prior to calling update. | 78 // off the invalidation prior to calling update. |
| 80 pile_invalidation_.Swap(pending_invalidation_); | 79 pile_invalidation_.Swap(pending_invalidation_); |
| 81 pending_invalidation_.Clear(); | 80 pending_invalidation_.Clear(); |
| 82 | 81 |
| 83 gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( | 82 gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( |
| 84 gfx::ScaleRect(visible_content_rect(), 1.f / contents_scale_x())); | 83 gfx::ScaleRect(visible_content_rect(), 1.f / contents_scale_x())); |
| 85 devtools_instrumentation::ScopedPaintLayer paint_layer(id()); | 84 devtools_instrumentation::ScopedPaintLayer paint_layer(id()); |
| 86 pile_->Update(client_, | 85 pile_->Update(client_, |
| 87 background_color(), | 86 background_color(), |
| 88 pile_invalidation_, | 87 pile_invalidation_, |
| 89 visible_layer_rect, | 88 visible_layer_rect, |
| 90 stats); | 89 rendering_stats_instrumentation()); |
| 91 } | 90 } |
| 92 | 91 |
| 93 void PictureLayer::SetIsMask(bool is_mask) { | 92 void PictureLayer::SetIsMask(bool is_mask) { |
| 94 is_mask_ = is_mask; | 93 is_mask_ = is_mask; |
| 95 } | 94 } |
| 96 | 95 |
| 97 } // namespace cc | 96 } // namespace cc |
| OLD | NEW |