OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/compositor_frame.h" | 10 #include "cc/compositor_frame.h" |
11 #include "cc/output_surface.h" | 11 #include "cc/output_surface.h" |
12 #include "cc/test/fake_software_output_device.h" | 12 #include "cc/test/fake_software_output_device.h" |
13 #include "cc/test/fake_web_graphics_context_3d.h" | 13 #include "cc/test/test_web_graphics_context_3d.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class FakeOutputSurface : public OutputSurface { | 18 class FakeOutputSurface : public OutputSurface { |
19 public: | 19 public: |
20 virtual ~FakeOutputSurface(); | 20 virtual ~FakeOutputSurface(); |
21 | 21 |
22 static inline scoped_ptr<FakeOutputSurface> Create3d( | 22 static inline scoped_ptr<FakeOutputSurface> Create3d( |
23 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { | 23 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { |
24 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); | 24 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); |
25 } | 25 } |
26 | 26 |
27 static inline scoped_ptr<FakeOutputSurface> Create3d() { | 27 static inline scoped_ptr<FakeOutputSurface> Create3d() { |
28 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = | 28 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = |
29 FakeWebGraphicsContext3D::Create( | 29 TestWebGraphicsContext3D::Create( |
30 WebKit::WebGraphicsContext3D::Attributes()) | 30 WebKit::WebGraphicsContext3D::Attributes()) |
31 .PassAs<WebKit::WebGraphicsContext3D>(); | 31 .PassAs<WebKit::WebGraphicsContext3D>(); |
32 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); | 32 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); |
33 } | 33 } |
34 | 34 |
35 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( | 35 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( |
36 scoped_ptr<SoftwareOutputDevice> software_device) { | 36 scoped_ptr<SoftwareOutputDevice> software_device) { |
37 return make_scoped_ptr( | 37 return make_scoped_ptr( |
38 new FakeOutputSurface(software_device.Pass(), false)); | 38 new FakeOutputSurface(software_device.Pass(), false)); |
39 } | 39 } |
40 | 40 |
41 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 41 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
42 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { | 42 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { |
43 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); | 43 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); |
44 } | 44 } |
45 | 45 |
46 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d() { | 46 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d() { |
47 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = | 47 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = |
48 FakeWebGraphicsContext3D::Create( | 48 TestWebGraphicsContext3D::Create( |
49 WebKit::WebGraphicsContext3D::Attributes()) | 49 WebKit::WebGraphicsContext3D::Attributes()) |
50 .PassAs<WebKit::WebGraphicsContext3D>(); | 50 .PassAs<WebKit::WebGraphicsContext3D>(); |
51 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); | 51 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); |
52 } | 52 } |
53 | 53 |
54 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( | 54 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( |
55 scoped_ptr<SoftwareOutputDevice> software_device) { | 55 scoped_ptr<SoftwareOutputDevice> software_device) { |
56 return make_scoped_ptr( | 56 return make_scoped_ptr( |
57 new FakeOutputSurface(software_device.Pass(), true)); | 57 new FakeOutputSurface(software_device.Pass(), true)); |
58 } | 58 } |
(...skipping 20 matching lines...) Expand all Loading... |
79 scoped_ptr<SoftwareOutputDevice> software_device_; | 79 scoped_ptr<SoftwareOutputDevice> software_device_; |
80 struct Capabilities capabilities_; | 80 struct Capabilities capabilities_; |
81 OutputSurfaceClient* client_; | 81 OutputSurfaceClient* client_; |
82 CompositorFrame last_sent_frame_; | 82 CompositorFrame last_sent_frame_; |
83 size_t num_sent_frames_; | 83 size_t num_sent_frames_; |
84 }; | 84 }; |
85 | 85 |
86 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() | 86 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() |
87 { | 87 { |
88 return FakeOutputSurface::Create3d( | 88 return FakeOutputSurface::Create3d( |
89 FakeWebGraphicsContext3D::Create( | 89 TestWebGraphicsContext3D::Create( |
90 WebKit::WebGraphicsContext3D::Attributes()) | 90 WebKit::WebGraphicsContext3D::Attributes()) |
91 .PassAs<WebKit::WebGraphicsContext3D>()) | 91 .PassAs<WebKit::WebGraphicsContext3D>()) |
92 .PassAs<cc::OutputSurface>(); | 92 .PassAs<cc::OutputSurface>(); |
93 } | 93 } |
94 | 94 |
95 } // namespace cc | 95 } // namespace cc |
96 | 96 |
97 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 97 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |