OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "aura/desktop.h" | |
6 | |
7 #include <algorithm> | |
8 | |
9 #include "aura/window.h" | |
10 #include "base/logging.h" | |
11 #include "ui/gfx/compositor/compositor.h" | |
12 | |
13 namespace aura { | |
14 | |
15 Desktop::Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size) | |
16 : compositor_(ui::Compositor::Create(widget, size)) { | |
17 DCHECK(compositor_.get()); | |
18 } | |
19 | |
20 Desktop::~Desktop() { | |
21 } | |
22 | |
23 void Desktop::Draw() { | |
24 // First pass updates the layer bitmaps. | |
25 for (Windows::iterator i = windows_.begin(); i != windows_.end(); ++i) | |
Daniel Erat
2011/07/28 23:00:37
nit: i think that i've more commonly seen 'it' use
| |
26 (*i)->UpdateLayerCanvas(); | |
27 | |
28 // Second pass renders the layers. | |
29 compositor_->NotifyStart(); | |
30 for (Windows::iterator i = windows_.begin(); i != windows_.end(); ++i) | |
31 (*i)->Draw(); | |
32 compositor_->NotifyEnd(); | |
33 } | |
34 | |
35 void Desktop::Show(Window* window) { | |
36 DCHECK(std::find(windows_.begin(), windows_.end(), window) == windows_.end()); | |
37 windows_.push_back(window); | |
38 } | |
39 | |
40 void Desktop::Hide(Window* window) { | |
41 Windows::iterator i = std::find(windows_.begin(), windows_.end(), window); | |
42 DCHECK(i != windows_.end()); | |
43 windows_.erase(i); | |
44 } | |
45 | |
46 } // namespace aura | |
OLD | NEW |