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