| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); | 54 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); |
| 55 if (!rect.IsEmpty()) { | 55 if (!rect.IsEmpty()) { |
| 56 // Clamp invalidation to the layer bounds. | 56 // Clamp invalidation to the layer bounds. |
| 57 rect.Intersect(gfx::Rect(bounds())); | 57 rect.Intersect(gfx::Rect(bounds())); |
| 58 pending_invalidation_.Union(rect); | 58 pending_invalidation_.Union(rect); |
| 59 } | 59 } |
| 60 Layer::setNeedsDisplayRect(layer_rect); | 60 Layer::setNeedsDisplayRect(layer_rect); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, | 63 void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, |
| 64 RenderingStats& stats) { | 64 RenderingStats* stats) { |
| 65 // Do not early-out of this function so that PicturePile::Update has a chance | 65 // Do not early-out of this function so that PicturePile::Update has a chance |
| 66 // to record pictures due to changing visibility of this layer. | 66 // to record pictures due to changing visibility of this layer. |
| 67 | 67 |
| 68 pile_->Resize(bounds()); | 68 pile_->Resize(bounds()); |
| 69 | 69 |
| 70 // Calling paint in WebKit can sometimes cause invalidations, so save | 70 // Calling paint in WebKit can sometimes cause invalidations, so save |
| 71 // off the invalidation prior to calling update. | 71 // off the invalidation prior to calling update. |
| 72 pile_invalidation_.Swap(pending_invalidation_); | 72 pile_invalidation_.Swap(pending_invalidation_); |
| 73 pending_invalidation_.Clear(); | 73 pending_invalidation_.Clear(); |
| 74 | 74 |
| 75 gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( | 75 gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( |
| 76 gfx::ScaleRect(visibleContentRect(), 1.f / contentsScaleX())); | 76 gfx::ScaleRect(visibleContentRect(), 1.f / contentsScaleX())); |
| 77 pile_->Update(client_, pile_invalidation_, visible_layer_rect, stats); | 77 pile_->Update(client_, pile_invalidation_, visible_layer_rect, stats); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void PictureLayer::setIsMask(bool is_mask) { | 80 void PictureLayer::setIsMask(bool is_mask) { |
| 81 is_mask_ = is_mask; | 81 is_mask_ = is_mask; |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace cc | 84 } // namespace cc |
| OLD | NEW |