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/compositor/test/test_compositor_host.h" | 5 #include "ui/compositor/test/test_compositor_host.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "ui/compositor/compositor.h" | 12 #include "ui/compositor/compositor.h" |
13 #include "ui/gfx/win/window_impl.h" | 13 #include "ui/gfx/win/window_impl.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 class TestCompositorHostWin : public TestCompositorHost, | 17 class TestCompositorHostWin : public TestCompositorHost, |
18 public gfx::WindowImpl { | 18 public gfx::WindowImpl { |
19 public: | 19 public: |
20 TestCompositorHostWin(const gfx::Rect& bounds, | 20 TestCompositorHostWin(const gfx::Rect& bounds, |
21 ui::ContextFactory* context_factory, | 21 ui::ContextFactory* context_factory, |
22 ui::ContextFactoryPrivate* context_factory_private) { | 22 ui::ContextFactoryPrivate* context_factory_private) { |
23 Init(NULL, bounds); | 23 Init(NULL, bounds); |
24 compositor_.reset(new ui::Compositor( | 24 compositor_.reset(new ui::Compositor( |
25 context_factory_private->AllocateFrameSinkId(), context_factory, | 25 context_factory_private->AllocateFrameSinkId(), context_factory, |
26 context_factory_private, base::ThreadTaskRunnerHandle::Get(), | 26 context_factory_private, base::ThreadTaskRunnerHandle::Get(), |
27 false /* enable_surface_synchronization */)); | 27 false /* enable_surface_synchronization */, |
| 28 false /* enable_pixel_canvas */)); |
28 compositor_->SetAcceleratedWidget(hwnd()); | 29 compositor_->SetAcceleratedWidget(hwnd()); |
29 compositor_->SetScaleAndSize(1.0f, GetSize()); | 30 compositor_->SetScaleAndSize(1.0f, GetSize()); |
30 } | 31 } |
31 | 32 |
32 ~TestCompositorHostWin() override { DestroyWindow(hwnd()); } | 33 ~TestCompositorHostWin() override { DestroyWindow(hwnd()); } |
33 | 34 |
34 // Overridden from TestCompositorHost: | 35 // Overridden from TestCompositorHost: |
35 void Show() override { | 36 void Show() override { |
36 ShowWindow(hwnd(), SW_SHOWNORMAL); | 37 ShowWindow(hwnd(), SW_SHOWNORMAL); |
37 compositor_->SetVisible(true); | 38 compositor_->SetVisible(true); |
(...skipping 23 matching lines...) Expand all Loading... |
61 | 62 |
62 TestCompositorHost* TestCompositorHost::Create( | 63 TestCompositorHost* TestCompositorHost::Create( |
63 const gfx::Rect& bounds, | 64 const gfx::Rect& bounds, |
64 ui::ContextFactory* context_factory, | 65 ui::ContextFactory* context_factory, |
65 ui::ContextFactoryPrivate* context_factory_private) { | 66 ui::ContextFactoryPrivate* context_factory_private) { |
66 return new TestCompositorHostWin(bounds, context_factory, | 67 return new TestCompositorHostWin(bounds, context_factory, |
67 context_factory_private); | 68 context_factory_private); |
68 } | 69 } |
69 | 70 |
70 } // namespace ui | 71 } // namespace ui |
OLD | NEW |