| 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/test/test_compositor_host.h" | 5 #include "ui/gfx/compositor/test/test_compositor_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 CopyFromParent, // visual | 68 CopyFromParent, // visual |
| 69 CWEventMask | CWOverrideRedirect, &swa); | 69 CWEventMask | CWOverrideRedirect, &swa); |
| 70 XMapWindow(display, window_); | 70 XMapWindow(display, window_); |
| 71 | 71 |
| 72 while (1) { | 72 while (1) { |
| 73 XEvent event; | 73 XEvent event; |
| 74 XNextEvent(display, &event); | 74 XNextEvent(display, &event); |
| 75 if (event.type == MapNotify && event.xmap.window == window_) | 75 if (event.type == MapNotify && event.xmap.window == window_) |
| 76 break; | 76 break; |
| 77 } | 77 } |
| 78 compositor_.reset(new ui::Compositor(this, window_, bounds_.size())); | 78 compositor_.reset(new ui::Compositor(this, window_)); |
| 79 compositor_->WidgetScaleOrSizeChanged(1.0f, bounds_.size()); |
| 79 } | 80 } |
| 80 | 81 |
| 81 ui::Compositor* TestCompositorHostLinux::GetCompositor() { | 82 ui::Compositor* TestCompositorHostLinux::GetCompositor() { |
| 82 return compositor_.get(); | 83 return compositor_.get(); |
| 83 } | 84 } |
| 84 | 85 |
| 85 void TestCompositorHostLinux::ScheduleDraw() { | 86 void TestCompositorHostLinux::ScheduleDraw() { |
| 86 if (!method_factory_.HasWeakPtrs()) { | 87 if (!method_factory_.HasWeakPtrs()) { |
| 87 MessageLoopForUI::current()->PostTask( | 88 MessageLoopForUI::current()->PostTask( |
| 88 FROM_HERE, | 89 FROM_HERE, |
| 89 base::Bind(&TestCompositorHostLinux::Draw, | 90 base::Bind(&TestCompositorHostLinux::Draw, |
| 90 method_factory_.GetWeakPtr())); | 91 method_factory_.GetWeakPtr())); |
| 91 } | 92 } |
| 92 } | 93 } |
| 93 | 94 |
| 94 void TestCompositorHostLinux::Draw() { | 95 void TestCompositorHostLinux::Draw() { |
| 95 if (compositor_.get()) | 96 if (compositor_.get()) |
| 96 compositor_->Draw(false); | 97 compositor_->Draw(false); |
| 97 } | 98 } |
| 98 | 99 |
| 99 // static | 100 // static |
| 100 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 101 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { |
| 101 return new TestCompositorHostLinux(bounds); | 102 return new TestCompositorHostLinux(bounds); |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace ui | 105 } // namespace ui |
| OLD | NEW |