Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: ui/gfx/compositor/compositor.cc

Issue 8360018: Revert 106606 - Use WebKit compositor in ui::Layer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/compositor/compositor.h ('k') | ui/gfx/compositor/compositor.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
11 11
12 TextureDrawParams::TextureDrawParams() 12 TextureDrawParams::TextureDrawParams()
13 : blend(false), 13 : blend(false),
14 has_valid_alpha_channel(false), 14 has_valid_alpha_channel(false),
15 opacity(1.0f), 15 opacity(1.0f),
16 vertically_flipped(false) { 16 vertically_flipped(false) {
17 } 17 }
18 18
19 Compositor::Compositor(CompositorDelegate* delegate, const gfx::Size& size) 19 Compositor::Compositor(CompositorDelegate* delegate, const gfx::Size& size)
20 : delegate_(delegate), 20 : delegate_(delegate),
21 size_(size), 21 size_(size),
22 root_layer_(NULL) { 22 root_layer_(NULL) {
23 } 23 }
24 24
25 Compositor::~Compositor() { 25 Compositor::~Compositor() {
26 } 26 }
27 27
28 void Compositor::ScheduleDraw() {
29 delegate_->ScheduleDraw();
30 }
31
32 void Compositor::SetRootLayer(Layer* root_layer) { 28 void Compositor::SetRootLayer(Layer* root_layer) {
33 root_layer_ = root_layer; 29 root_layer_ = root_layer;
34 if (!root_layer_->GetCompositor()) 30 if (!root_layer_->GetCompositor())
35 root_layer_->SetCompositor(this); 31 root_layer_->SetCompositor(this);
36 OnRootLayerChanged();
37 } 32 }
38 33
39 void Compositor::Draw(bool force_clear) { 34 void Compositor::Draw(bool force_clear) {
40 if (!root_layer_) 35 if (!root_layer_)
41 return; 36 return;
42 37
43 NotifyStart(force_clear); 38 NotifyStart(force_clear);
44 DrawTree(); 39 root_layer_->DrawTree();
45 NotifyEnd(); 40 NotifyEnd();
46 } 41 }
47 42
48 void Compositor::AddObserver(CompositorObserver* observer) { 43 void Compositor::AddObserver(CompositorObserver* observer) {
49 observer_list_.AddObserver(observer); 44 observer_list_.AddObserver(observer);
50 } 45 }
51 46
52 void Compositor::RemoveObserver(CompositorObserver* observer) { 47 void Compositor::RemoveObserver(CompositorObserver* observer) {
53 observer_list_.RemoveObserver(observer); 48 observer_list_.RemoveObserver(observer);
54 } 49 }
55 50
56 bool Compositor::HasObserver(CompositorObserver* observer) { 51 bool Compositor::HasObserver(CompositorObserver* observer) {
57 return observer_list_.HasObserver(observer); 52 return observer_list_.HasObserver(observer);
58 } 53 }
59 54
60 void Compositor::OnRootLayerChanged() {
61 ScheduleDraw();
62 }
63
64 void Compositor::DrawTree() {
65 root_layer_->DrawTree();
66 }
67
68 void Compositor::NotifyStart(bool clear) { 55 void Compositor::NotifyStart(bool clear) {
69 OnNotifyStart(clear); 56 OnNotifyStart(clear);
70 } 57 }
71 58
72 void Compositor::NotifyEnd() { 59 void Compositor::NotifyEnd() {
73 OnNotifyEnd(); 60 OnNotifyEnd();
74 FOR_EACH_OBSERVER(CompositorObserver, 61 FOR_EACH_OBSERVER(CompositorObserver,
75 observer_list_, 62 observer_list_,
76 OnCompositingEnded(this)); 63 OnCompositingEnded(this));
77 } 64 }
78 65
79 } // namespace ui 66 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/compositor.h ('k') | ui/gfx/compositor/compositor.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698