OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 sk_canvas, device_scale_factor_)); | 743 sk_canvas, device_scale_factor_)); |
744 if (delegate_) | 744 if (delegate_) |
745 delegate_->OnPaintLayer(PaintContext(canvas.get(), clip)); | 745 delegate_->OnPaintLayer(PaintContext(canvas.get(), clip)); |
746 } | 746 } |
747 | 747 |
748 void Layer::PaintContentsToDisplayList( | 748 void Layer::PaintContentsToDisplayList( |
749 cc::DisplayItemList* display_list, | 749 cc::DisplayItemList* display_list, |
750 const gfx::Rect& clip, | 750 const gfx::Rect& clip, |
751 ContentLayerClient::PaintingControlSetting painting_control) { | 751 ContentLayerClient::PaintingControlSetting painting_control) { |
752 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); | 752 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); |
753 gfx::Rect local_bounds(bounds().size()); | |
754 gfx::Rect invalidation( | |
755 gfx::IntersectRects(damaged_region_.bounds(), local_bounds)); | |
756 DCHECK(clip.Contains(invalidation)); | |
757 ClearDamagedRects(); | 753 ClearDamagedRects(); |
758 if (!delegate_) | 754 if (!delegate_) |
759 return; | 755 return; |
| 756 // TODO(danakj): Save the invalidation on the layer and pass that down |
| 757 // instead of the |clip| here. That will break everything until View |
| 758 // early-outs emit cached display items instead of nothing. |
| 759 gfx::Rect invalidation = clip; |
| 760 DCHECK(clip.Contains(invalidation)); |
760 delegate_->OnPaintLayer( | 761 delegate_->OnPaintLayer( |
761 PaintContext(display_list, device_scale_factor_, clip, invalidation)); | 762 PaintContext(display_list, device_scale_factor_, clip, invalidation)); |
762 } | 763 } |
763 | 764 |
764 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } | 765 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } |
765 | 766 |
766 bool Layer::PrepareTextureMailbox( | 767 bool Layer::PrepareTextureMailbox( |
767 cc::TextureMailbox* mailbox, | 768 cc::TextureMailbox* mailbox, |
768 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 769 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
769 bool use_shared_memory) { | 770 bool use_shared_memory) { |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 children_.end(), | 1086 children_.end(), |
1086 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), | 1087 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), |
1087 collection)); | 1088 collection)); |
1088 } | 1089 } |
1089 | 1090 |
1090 bool Layer::IsAnimating() const { | 1091 bool Layer::IsAnimating() const { |
1091 return animator_.get() && animator_->is_animating(); | 1092 return animator_.get() && animator_->is_animating(); |
1092 } | 1093 } |
1093 | 1094 |
1094 } // namespace ui | 1095 } // namespace ui |
OLD | NEW |