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 "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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 TestCompositorHostOzone::TestCompositorHostOzone( | 39 TestCompositorHostOzone::TestCompositorHostOzone( |
40 const gfx::Rect& bounds, | 40 const gfx::Rect& bounds, |
41 ui::ContextFactory* context_factory) | 41 ui::ContextFactory* context_factory) |
42 : bounds_(bounds), | 42 : bounds_(bounds), |
43 context_factory_(context_factory) {} | 43 context_factory_(context_factory) {} |
44 | 44 |
45 TestCompositorHostOzone::~TestCompositorHostOzone() {} | 45 TestCompositorHostOzone::~TestCompositorHostOzone() {} |
46 | 46 |
47 void TestCompositorHostOzone::Show() { | 47 void TestCompositorHostOzone::Show() { |
| 48 compositor_.reset(new ui::Compositor(context_factory_, |
| 49 base::ThreadTaskRunnerHandle::Get())); |
48 // Ozone should rightly have a backing native framebuffer | 50 // Ozone should rightly have a backing native framebuffer |
49 // An in-memory array draw into by OSMesa is a reasonble | 51 // An in-memory array draw into by OSMesa is a reasonble |
50 // fascimile of a dumb framebuffer at present. | 52 // fascimile of a dumb framebuffer at present. |
51 // GLSurface will allocate the array so long as it is provided | 53 // GLSurface will allocate the array so long as it is provided |
52 // with a non-0 widget. | 54 // with a non-0 widget. |
53 // TODO(rjkroege): Use a "real" ozone widget when it is | 55 // TODO(rjkroege): Use a "real" ozone widget when it is |
54 // available: http://crbug.com/255128 | 56 // available: http://crbug.com/255128 |
55 compositor_.reset(new ui::Compositor(1, | 57 compositor_->OnAcceleratedWidgetAvailable(1); |
56 context_factory_, | |
57 base::ThreadTaskRunnerHandle::Get())); | |
58 compositor_->SetScaleAndSize(1.0f, bounds_.size()); | 58 compositor_->SetScaleAndSize(1.0f, bounds_.size()); |
59 } | 59 } |
60 | 60 |
61 ui::Compositor* TestCompositorHostOzone::GetCompositor() { | 61 ui::Compositor* TestCompositorHostOzone::GetCompositor() { |
62 return compositor_.get(); | 62 return compositor_.get(); |
63 } | 63 } |
64 | 64 |
65 // static | 65 // static |
66 TestCompositorHost* TestCompositorHost::Create( | 66 TestCompositorHost* TestCompositorHost::Create( |
67 const gfx::Rect& bounds, | 67 const gfx::Rect& bounds, |
68 ui::ContextFactory* context_factory) { | 68 ui::ContextFactory* context_factory) { |
69 return new TestCompositorHostOzone(bounds, context_factory); | 69 return new TestCompositorHostOzone(bounds, context_factory); |
70 } | 70 } |
71 | 71 |
72 } // namespace ui | 72 } // namespace ui |
OLD | NEW |