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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 Init(NULL, bounds); | 22 Init(NULL, bounds); |
23 compositor_.reset(new ui::Compositor(context_factory, | 23 compositor_.reset(new ui::Compositor(context_factory, |
24 base::ThreadTaskRunnerHandle::Get())); | 24 base::ThreadTaskRunnerHandle::Get())); |
25 compositor_->SetAcceleratedWidget(hwnd()); | 25 compositor_->SetAcceleratedWidget(hwnd()); |
26 compositor_->SetScaleAndSize(1.0f, GetSize()); | 26 compositor_->SetScaleAndSize(1.0f, GetSize()); |
27 } | 27 } |
28 | 28 |
29 ~TestCompositorHostWin() override { DestroyWindow(hwnd()); } | 29 ~TestCompositorHostWin() override { DestroyWindow(hwnd()); } |
30 | 30 |
31 // Overridden from TestCompositorHost: | 31 // Overridden from TestCompositorHost: |
32 void Show() override { ShowWindow(hwnd(), SW_SHOWNORMAL); } | 32 void Show() override { |
| 33 ShowWindow(hwnd(), SW_SHOWNORMAL); |
| 34 compositor_->SetVisible(true); |
| 35 } |
33 ui::Compositor* GetCompositor() override { return compositor_.get(); } | 36 ui::Compositor* GetCompositor() override { return compositor_.get(); } |
34 | 37 |
35 private: | 38 private: |
36 CR_BEGIN_MSG_MAP_EX(TestCompositorHostWin) | 39 CR_BEGIN_MSG_MAP_EX(TestCompositorHostWin) |
37 CR_MSG_WM_PAINT(OnPaint) | 40 CR_MSG_WM_PAINT(OnPaint) |
38 CR_END_MSG_MAP() | 41 CR_END_MSG_MAP() |
39 | 42 |
40 void OnPaint(HDC dc) { | 43 void OnPaint(HDC dc) { |
41 compositor_->ScheduleFullRedraw(); | 44 compositor_->ScheduleFullRedraw(); |
42 ValidateRect(hwnd(), NULL); | 45 ValidateRect(hwnd(), NULL); |
(...skipping 10 matching lines...) Expand all Loading... |
53 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostWin); | 56 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostWin); |
54 }; | 57 }; |
55 | 58 |
56 TestCompositorHost* TestCompositorHost::Create( | 59 TestCompositorHost* TestCompositorHost::Create( |
57 const gfx::Rect& bounds, | 60 const gfx::Rect& bounds, |
58 ui::ContextFactory* context_factory) { | 61 ui::ContextFactory* context_factory) { |
59 return new TestCompositorHostWin(bounds, context_factory); | 62 return new TestCompositorHostWin(bounds, context_factory); |
60 } | 63 } |
61 | 64 |
62 } // namespace ui | 65 } // namespace ui |
OLD | NEW |