OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/compositor/compositor.h" | 5 #include "ui/gfx/compositor/compositor.h" |
6 | 6 |
7 #include "ui/gfx/compositor/compositor_observer.h" | 7 #include "ui/gfx/compositor/compositor_observer.h" |
8 #include "ui/gfx/compositor/layer.h" | 8 #include "ui/gfx/compositor/layer.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
(...skipping 17 matching lines...) Expand all Loading... |
28 Compositor::~Compositor() { | 28 Compositor::~Compositor() { |
29 if (root_layer_) | 29 if (root_layer_) |
30 root_layer_->SetCompositor(NULL); | 30 root_layer_->SetCompositor(NULL); |
31 } | 31 } |
32 | 32 |
33 void Compositor::ScheduleDraw() { | 33 void Compositor::ScheduleDraw() { |
34 delegate_->ScheduleDraw(); | 34 delegate_->ScheduleDraw(); |
35 } | 35 } |
36 | 36 |
37 void Compositor::SetRootLayer(Layer* root_layer) { | 37 void Compositor::SetRootLayer(Layer* root_layer) { |
| 38 if (root_layer_ == root_layer) |
| 39 return; |
38 if (root_layer_) | 40 if (root_layer_) |
39 root_layer_->SetCompositor(NULL); | 41 root_layer_->SetCompositor(NULL); |
40 root_layer_ = root_layer; | 42 root_layer_ = root_layer; |
41 if (root_layer_ && !root_layer_->GetCompositor()) | 43 if (root_layer_ && !root_layer_->GetCompositor()) |
42 root_layer_->SetCompositor(this); | 44 root_layer_->SetCompositor(this); |
43 OnRootLayerChanged(); | 45 OnRootLayerChanged(); |
44 } | 46 } |
45 | 47 |
46 void Compositor::Draw(bool force_clear) { | 48 void Compositor::Draw(bool force_clear) { |
47 if (!root_layer_) | 49 if (!root_layer_) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 102 } |
101 | 103 |
102 void Compositor::NotifyEnd() { | 104 void Compositor::NotifyEnd() { |
103 OnNotifyEnd(); | 105 OnNotifyEnd(); |
104 FOR_EACH_OBSERVER(CompositorObserver, | 106 FOR_EACH_OBSERVER(CompositorObserver, |
105 observer_list_, | 107 observer_list_, |
106 OnCompositingEnded(this)); | 108 OnCompositingEnded(this)); |
107 } | 109 } |
108 | 110 |
109 } // namespace ui | 111 } // namespace ui |
OLD | NEW |