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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
10 #include "ui/gfx/win/window_impl.h" | 10 #include "ui/gfx/win/window_impl.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 class TestCompositorHostWin : public TestCompositorHost, | 14 class TestCompositorHostWin : public TestCompositorHost, |
15 public gfx::WindowImpl { | 15 public gfx::WindowImpl { |
16 public: | 16 public: |
17 TestCompositorHostWin(const gfx::Rect& bounds) { | 17 TestCompositorHostWin(const gfx::Rect& bounds, |
| 18 ui::ContextFactory* context_factory) { |
18 Init(NULL, bounds); | 19 Init(NULL, bounds); |
19 compositor_.reset(new ui::Compositor(hwnd())); | 20 compositor_.reset(new ui::Compositor(hwnd(), context_factory)); |
20 compositor_->SetScaleAndSize(1.0f, GetSize()); | 21 compositor_->SetScaleAndSize(1.0f, GetSize()); |
21 } | 22 } |
22 | 23 |
23 virtual ~TestCompositorHostWin() { | 24 virtual ~TestCompositorHostWin() { |
24 DestroyWindow(hwnd()); | 25 DestroyWindow(hwnd()); |
25 } | 26 } |
26 | 27 |
27 // Overridden from TestCompositorHost: | 28 // Overridden from TestCompositorHost: |
28 virtual void Show() OVERRIDE { | 29 virtual void Show() OVERRIDE { |
29 ShowWindow(hwnd(), SW_SHOWNORMAL); | 30 ShowWindow(hwnd(), SW_SHOWNORMAL); |
(...skipping 16 matching lines...) Expand all Loading... |
46 RECT r; | 47 RECT r; |
47 GetClientRect(hwnd(), &r); | 48 GetClientRect(hwnd(), &r); |
48 return gfx::Rect(r).size(); | 49 return gfx::Rect(r).size(); |
49 } | 50 } |
50 | 51 |
51 scoped_ptr<ui::Compositor> compositor_; | 52 scoped_ptr<ui::Compositor> compositor_; |
52 | 53 |
53 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostWin); | 54 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostWin); |
54 }; | 55 }; |
55 | 56 |
56 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 57 TestCompositorHost* TestCompositorHost::Create( |
57 return new TestCompositorHostWin(bounds); | 58 const gfx::Rect& bounds, |
| 59 ui::ContextFactory* context_factory) { |
| 60 return new TestCompositorHostWin(bounds, context_factory); |
58 } | 61 } |
59 | 62 |
60 } // namespace ui | 63 } // namespace ui |
OLD | NEW |