summaryrefslogtreecommitdiffstats
path: root/views/widget/widget.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 18:26:25 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 18:26:25 +0000
commitc36b0bfba80a88ce3776739575a1103235c409d1 (patch)
treed37790e560bff4136f3c723c95c645abec7caf76 /views/widget/widget.cc
parent5b37cb72a5bfbcc1daa57249319a8235d0d4874a (diff)
downloadchromium_src-c36b0bfba80a88ce3776739575a1103235c409d1.zip
chromium_src-c36b0bfba80a88ce3776739575a1103235c409d1.tar.gz
chromium_src-c36b0bfba80a88ce3776739575a1103235c409d1.tar.bz2
Tweaks Compositor API. To make it possible to land this I've ifdef'd
the code in a couple of places. BUG=none TEST=none R=ben@chromium.org,wjmaclean@chromium.org,rjkroege@chromium.org Review URL: http://codereview.chromium.org/6999005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84823 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/widget.cc')
-rw-r--r--views/widget/widget.cc40
1 files changed, 25 insertions, 15 deletions
diff --git a/views/widget/widget.cc b/views/widget/widget.cc
index 71cd85f..a7c03d9 100644
--- a/views/widget/widget.cc
+++ b/views/widget/widget.cc
@@ -314,6 +314,7 @@ void Widget::OnNativeWidgetCreated() {
// manager.
focus_manager_.reset(new FocusManager(this));
}
+ EnsureCompositor();
}
void Widget::OnSizeChanged(const gfx::Size& new_size) {
@@ -324,9 +325,30 @@ bool Widget::HasFocusManager() const {
return !!focus_manager_.get();
}
+bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) {
+#if !defined(COMPOSITOR_2)
+ return false;
+#else
+ if (!compositor_.get())
+ return false;
+
+ compositor_->NotifyStart();
+ GetRootView()->PaintToTexture(dirty_region);
+ GetRootView()->PaintComposite();
+ compositor_->NotifyEnd();
+ return true;
+#endif
+}
+
void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) {
GetRootView()->Paint(canvas);
- RefreshCompositeTree();
+#if !defined(COMPOSITOR_2)
+ if (compositor_.get()) {
+ compositor_->NotifyStart();
+ root_view_->PaintComposite(compositor_.get());
+ compositor_->NotifyEnd();
+ }
+#endif
}
bool Widget::OnKeyEvent(const KeyEvent& event) {
@@ -435,26 +457,14 @@ void Widget::ReplaceFocusManager(FocusManager* focus_manager) {
////////////////////////////////////////////////////////////////////////////////
// Widget, private:
-void Widget::RefreshCompositeTree() {
- if (!EnsureCompositor())
- return;
-
- compositor_->NotifyStart();
- root_view_->PaintComposite(compositor_.get());
- compositor_->NotifyEnd();
-}
-
-bool Widget::EnsureCompositor() {
- if (compositor_.get())
- return true;
+void Widget::EnsureCompositor() {
+ DCHECK(!compositor_.get());
// TODO(sad): If there is a parent Widget, then use the same compositor
// instead of creating a new one here.
gfx::AcceleratedWidget widget = native_widget_->GetAcceleratedWidget();
if (widget != gfx::kNullAcceleratedWidget)
compositor_ = ui::Compositor::Create(widget);
-
- return compositor_.get() != NULL;
}
bool Widget::ShouldReleaseCaptureOnMouseReleased() const {