| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "ui/compositor/compositor.h" | 14 #include "ui/compositor/compositor.h" |
| 15 #include "ui/gfx/ozone/surface_factory_ozone.h" |
| 15 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 | 19 |
| 19 class TestCompositorHostOzone : public TestCompositorHost { | 20 class TestCompositorHostOzone : public TestCompositorHost { |
| 20 public: | 21 public: |
| 21 TestCompositorHostOzone(const gfx::Rect& bounds); | 22 TestCompositorHostOzone(const gfx::Rect& bounds); |
| 22 virtual ~TestCompositorHostOzone(); | 23 virtual ~TestCompositorHostOzone(); |
| 23 | 24 |
| 24 private: | 25 private: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 41 TestCompositorHostOzone::~TestCompositorHostOzone() {} | 42 TestCompositorHostOzone::~TestCompositorHostOzone() {} |
| 42 | 43 |
| 43 void TestCompositorHostOzone::Show() { | 44 void TestCompositorHostOzone::Show() { |
| 44 // Ozone should rightly have a backing native framebuffer | 45 // Ozone should rightly have a backing native framebuffer |
| 45 // An in-memory array draw into by OSMesa is a reasonble | 46 // An in-memory array draw into by OSMesa is a reasonble |
| 46 // fascimile of a dumb framebuffer at present. | 47 // fascimile of a dumb framebuffer at present. |
| 47 // GLSurface will allocate the array so long as it is provided | 48 // GLSurface will allocate the array so long as it is provided |
| 48 // with a non-0 widget. | 49 // with a non-0 widget. |
| 49 // TODO(rjkroege): Use a "real" ozone widget when it is | 50 // TODO(rjkroege): Use a "real" ozone widget when it is |
| 50 // available: http://crbug.com/255128 | 51 // available: http://crbug.com/255128 |
| 51 compositor_.reset(new ui::Compositor(1)); | 52 compositor_.reset(new ui::Compositor( |
| 53 gfx::kDefaultAcceleratedWidgetForSingleWindow)); |
| 52 compositor_->SetScaleAndSize(1.0f, bounds_.size()); | 54 compositor_->SetScaleAndSize(1.0f, bounds_.size()); |
| 53 } | 55 } |
| 54 | 56 |
| 55 ui::Compositor* TestCompositorHostOzone::GetCompositor() { | 57 ui::Compositor* TestCompositorHostOzone::GetCompositor() { |
| 56 return compositor_.get(); | 58 return compositor_.get(); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void TestCompositorHostOzone::Draw() { | 61 void TestCompositorHostOzone::Draw() { |
| 60 if (compositor_.get()) | 62 if (compositor_.get()) |
| 61 compositor_->Draw(); | 63 compositor_->Draw(); |
| 62 } | 64 } |
| 63 | 65 |
| 64 // static | 66 // static |
| 65 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 67 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { |
| 66 return new TestCompositorHostOzone(bounds); | 68 return new TestCompositorHostOzone(bounds); |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace ui | 71 } // namespace ui |
| OLD | NEW |