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

Unified Diff: aura/window.cc

Issue 7741027: Create a new views_aura_desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « aura/window.h ('k') | aura/window_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: aura/window.cc
===================================================================
--- aura/window.cc (revision 98234)
+++ aura/window.cc (working copy)
@@ -9,17 +9,15 @@
#include "aura/desktop.h"
#include "aura/window_delegate.h"
#include "base/logging.h"
-#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/layer.h"
namespace aura {
-// TODO: do we need to support child windows?
-Window::Window(Desktop* desktop)
- : delegate_(NULL),
+Window::Window(WindowDelegate* delegate)
+ : delegate_(delegate),
visibility_(VISIBILITY_HIDDEN),
- layer_(new ui::Layer(desktop->compositor())),
needs_paint_all_(true),
parent_(NULL),
id_(-1) {
@@ -28,6 +26,10 @@
Window::~Window() {
}
+void Window::Init() {
+ layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor()));
+}
+
void Window::SetVisibility(Visibility visibility) {
if (visibility_ == visibility)
return;
@@ -51,12 +53,19 @@
void Window::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) {
// TODO: figure out how this is going to work when animating the layer. In
- // particular if we're animating the size then the underyling Texture is going
+ // particular if we're animating the size then the underlying Texture is going
// to be unhappy if we try to set a texture on a size bigger than the size of
// the texture.
layer_->SetCanvas(canvas, origin);
}
+void Window::SetParent(Window* parent) {
+ if (parent)
+ parent->AddChild(this);
+ else
+ Desktop::GetInstance()->window()->AddChild(this);
+}
+
void Window::DrawTree() {
UpdateLayerCanvas();
Draw();
@@ -96,8 +105,13 @@
dirty_rect_.SetRect(0, 0, 0, 0);
if (dirty_rect.IsEmpty())
return;
- if (delegate_)
- delegate_->OnPaint(dirty_rect);
+ if (delegate_) {
+ scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvas(
+ dirty_rect.width(), dirty_rect.height(), false));
+ canvas->TranslateInt(dirty_rect.x(), dirty_rect.y());
+ delegate_->OnPaint(canvas.get());
+ SetCanvas(*canvas->AsCanvasSkia(), bounds().origin());
+ }
}
void Window::Draw() {
« no previous file with comments | « aura/window.h ('k') | aura/window_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698