| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/compositor/test/test_compositor_host.h" | 5 #include "ui/compositor/test/test_compositor_host.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 TestCompositorHostX11(const gfx::Rect& bounds, | 24 TestCompositorHostX11(const gfx::Rect& bounds, |
| 25 ui::ContextFactory* context_factory); | 25 ui::ContextFactory* context_factory); |
| 26 ~TestCompositorHostX11() override; | 26 ~TestCompositorHostX11() override; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // Overridden from TestCompositorHost: | 29 // Overridden from TestCompositorHost: |
| 30 void Show() override; | 30 void Show() override; |
| 31 ui::Compositor* GetCompositor() override; | 31 ui::Compositor* GetCompositor() override; |
| 32 | 32 |
| 33 void Draw(); |
| 34 |
| 33 gfx::Rect bounds_; | 35 gfx::Rect bounds_; |
| 34 | 36 |
| 35 ui::ContextFactory* context_factory_; | 37 ui::ContextFactory* context_factory_; |
| 36 | 38 |
| 37 scoped_ptr<ui::Compositor> compositor_; | 39 scoped_ptr<ui::Compositor> compositor_; |
| 38 | 40 |
| 39 XID window_; | 41 XID window_; |
| 40 | 42 |
| 41 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostX11); | 43 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostX11); |
| 42 }; | 44 }; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 compositor_.reset(new ui::Compositor(window_, | 78 compositor_.reset(new ui::Compositor(window_, |
| 77 context_factory_, | 79 context_factory_, |
| 78 base::ThreadTaskRunnerHandle::Get())); | 80 base::ThreadTaskRunnerHandle::Get())); |
| 79 compositor_->SetScaleAndSize(1.0f, bounds_.size()); | 81 compositor_->SetScaleAndSize(1.0f, bounds_.size()); |
| 80 } | 82 } |
| 81 | 83 |
| 82 ui::Compositor* TestCompositorHostX11::GetCompositor() { | 84 ui::Compositor* TestCompositorHostX11::GetCompositor() { |
| 83 return compositor_.get(); | 85 return compositor_.get(); |
| 84 } | 86 } |
| 85 | 87 |
| 88 void TestCompositorHostX11::Draw() { |
| 89 if (compositor_.get()) |
| 90 compositor_->Draw(); |
| 91 } |
| 92 |
| 86 // static | 93 // static |
| 87 TestCompositorHost* TestCompositorHost::Create( | 94 TestCompositorHost* TestCompositorHost::Create( |
| 88 const gfx::Rect& bounds, | 95 const gfx::Rect& bounds, |
| 89 ui::ContextFactory* context_factory) { | 96 ui::ContextFactory* context_factory) { |
| 90 return new TestCompositorHostX11(bounds, context_factory); | 97 return new TestCompositorHostX11(bounds, context_factory); |
| 91 } | 98 } |
| 92 | 99 |
| 93 } // namespace ui | 100 } // namespace ui |
| OLD | NEW |