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/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 // static | |
20 Compositor*(*Compositor::compositor_factory_)(CompositorDelegate*) = NULL; | |
21 | |
22 Compositor::Compositor(CompositorDelegate* delegate, const gfx::Size& size) | 19 Compositor::Compositor(CompositorDelegate* delegate, const gfx::Size& size) |
23 : delegate_(delegate), | 20 : delegate_(delegate), |
24 size_(size), | 21 size_(size), |
25 root_layer_(NULL) { | 22 root_layer_(NULL) { |
26 } | 23 } |
27 | 24 |
28 Compositor::~Compositor() { | 25 Compositor::~Compositor() { |
29 if (root_layer_) | 26 if (root_layer_) |
30 root_layer_->SetCompositor(NULL); | 27 root_layer_->SetCompositor(NULL); |
31 } | 28 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 63 |
67 bool Compositor::HasObserver(CompositorObserver* observer) { | 64 bool Compositor::HasObserver(CompositorObserver* observer) { |
68 return observer_list_.HasObserver(observer); | 65 return observer_list_.HasObserver(observer); |
69 } | 66 } |
70 | 67 |
71 void Compositor::OnRootLayerChanged() { | 68 void Compositor::OnRootLayerChanged() { |
72 ScheduleDraw(); | 69 ScheduleDraw(); |
73 } | 70 } |
74 | 71 |
75 void Compositor::DrawTree() { | 72 void Compositor::DrawTree() { |
76 root_layer_->DrawTree(); | |
77 } | 73 } |
78 | 74 |
79 bool Compositor::CompositesAsynchronously() { | 75 bool Compositor::CompositesAsynchronously() { |
80 return false; | 76 return false; |
81 } | 77 } |
82 | 78 |
83 void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, | 79 void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, |
84 const gfx::Size& image_size) { | 80 const gfx::Size& image_size) { |
85 // Swizzle from RGBA to BGRA | 81 // Swizzle from RGBA to BGRA |
86 size_t bitmap_size = 4 * image_size.width() * image_size.height(); | 82 size_t bitmap_size = 4 * image_size.width() * image_size.height(); |
(...skipping 21 matching lines...) Expand all Loading... |
108 FOR_EACH_OBSERVER(CompositorObserver, | 104 FOR_EACH_OBSERVER(CompositorObserver, |
109 observer_list_, | 105 observer_list_, |
110 OnCompositingEnded(this)); | 106 OnCompositingEnded(this)); |
111 } | 107 } |
112 | 108 |
113 void Compositor::NotifyStart(bool clear) { | 109 void Compositor::NotifyStart(bool clear) { |
114 OnNotifyStart(clear); | 110 OnNotifyStart(clear); |
115 } | 111 } |
116 | 112 |
117 } // namespace ui | 113 } // namespace ui |
OLD | NEW |