blob: c8b91874f244c065b612d2dcf68c6eb70ee550b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "aura/desktop.h"
#include <algorithm>
#include "aura/window.h"
#include "base/logging.h"
#include "ui/gfx/compositor/compositor.h"
namespace aura {
Desktop::Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size)
: compositor_(ui::Compositor::Create(widget, size)) {
DCHECK(compositor_.get());
}
Desktop::~Desktop() {
}
void Desktop::Draw() {
// First pass updates the layer bitmaps.
for (Windows::iterator i = windows_.begin(); i != windows_.end(); ++i)
(*i)->UpdateLayerCanvas();
// Second pass renders the layers.
compositor_->NotifyStart();
for (Windows::iterator i = windows_.begin(); i != windows_.end(); ++i)
(*i)->Draw();
compositor_->NotifyEnd();
}
void Desktop::AddWindow(Window* window) {
DCHECK(std::find(windows_.begin(), windows_.end(), window) == windows_.end());
windows_.push_back(window);
}
void Desktop::RemoveWindow(Window* window) {
Windows::iterator i = std::find(windows_.begin(), windows_.end(), window);
DCHECK(i != windows_.end());
windows_.erase(i);
}
} // namespace aura
|