OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/compositor/test_compositor.h" | 5 #include "ui/gfx/compositor/test_compositor.h" |
6 | 6 |
7 #include "ui/gfx/compositor/test_texture.h" | 7 #include "ui/gfx/compositor/test_texture.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
11 class TestCompositorDelegate : public ui::CompositorDelegate { | 11 class TestCompositorDelegate : public ui::CompositorDelegate { |
12 public: | 12 public: |
13 TestCompositorDelegate() {} | 13 TestCompositorDelegate() {} |
14 virtual ~TestCompositorDelegate() {} | 14 virtual ~TestCompositorDelegate() {} |
15 | 15 |
16 virtual void ScheduleDraw() OVERRIDE {} | 16 virtual void ScheduleDraw() OVERRIDE {} |
17 | 17 |
18 private: | 18 private: |
19 DISALLOW_COPY_AND_ASSIGN(TestCompositorDelegate); | 19 DISALLOW_COPY_AND_ASSIGN(TestCompositorDelegate); |
20 }; | 20 }; |
21 | 21 |
22 TestCompositor::TestCompositor() | 22 TestCompositor::TestCompositor(CompositorDelegate *owner) |
23 : Compositor(new TestCompositorDelegate, gfx::Size(100, 100)) { | 23 : Compositor((owner ? owner : new TestCompositorDelegate), |
24 owned_delegate_.reset(static_cast<TestCompositorDelegate*>(delegate())); | 24 gfx::Size(100, 100)) { |
| 25 if (!owner) |
| 26 owned_delegate_.reset(static_cast<TestCompositorDelegate*>(delegate())); |
25 } | 27 } |
26 | 28 |
27 TestCompositor::~TestCompositor() { | 29 TestCompositor::~TestCompositor() { |
28 } | 30 } |
29 | 31 |
30 ui::Texture* TestCompositor::CreateTexture() { | 32 ui::Texture* TestCompositor::CreateTexture() { |
31 return new TestTexture(); | 33 return new TestTexture(); |
32 } | 34 } |
33 | 35 |
34 void TestCompositor::OnNotifyStart(bool clear) { | 36 void TestCompositor::OnNotifyStart(bool clear) { |
35 } | 37 } |
36 | 38 |
37 void TestCompositor::OnNotifyEnd() { | 39 void TestCompositor::OnNotifyEnd() { |
38 } | 40 } |
39 | 41 |
40 void TestCompositor::Blur(const gfx::Rect& bounds) { | 42 void TestCompositor::Blur(const gfx::Rect& bounds) { |
41 } | 43 } |
42 | 44 |
43 void TestCompositor::DrawTree() { | 45 void TestCompositor::DrawTree() { |
44 #if !defined(USE_WEBKIT_COMPOSITOR) | 46 #if !defined(USE_WEBKIT_COMPOSITOR) |
45 Compositor::DrawTree(); | 47 Compositor::DrawTree(); |
46 #endif | 48 #endif |
47 } | 49 } |
48 | 50 |
| 51 ui::Compositor* TestCompositor::Create(ui::CompositorDelegate* owner) { |
| 52 return new ui::TestCompositor(owner); |
| 53 } |
| 54 |
49 void TestCompositor::OnWidgetSizeChanged() { | 55 void TestCompositor::OnWidgetSizeChanged() { |
50 } | 56 } |
51 | 57 |
52 } // namespace ui | 58 } // namespace ui |
OLD | NEW |