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/fake_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() { |
| 28 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = |
| 29 FakeWebGraphicsContext3D::Create( |
| 30 WebKit::WebGraphicsContext3D::Attributes()) |
| 31 .PassAs<WebKit::WebGraphicsContext3D>(); |
| 32 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); |
| 33 } |
| 34 |
27 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( | 35 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( |
28 scoped_ptr<SoftwareOutputDevice> software_device) { | 36 scoped_ptr<SoftwareOutputDevice> software_device) { |
29 return make_scoped_ptr( | 37 return make_scoped_ptr( |
30 new FakeOutputSurface(software_device.Pass(), false)); | 38 new FakeOutputSurface(software_device.Pass(), false)); |
31 } | 39 } |
32 | 40 |
33 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 41 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
34 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { | 42 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { |
35 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); | 43 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); |
36 } | 44 } |
37 | 45 |
| 46 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d() { |
| 47 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = |
| 48 FakeWebGraphicsContext3D::Create( |
| 49 WebKit::WebGraphicsContext3D::Attributes()) |
| 50 .PassAs<WebKit::WebGraphicsContext3D>(); |
| 51 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); |
| 52 } |
| 53 |
38 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( | 54 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( |
39 scoped_ptr<SoftwareOutputDevice> software_device) { | 55 scoped_ptr<SoftwareOutputDevice> software_device) { |
40 return make_scoped_ptr( | 56 return make_scoped_ptr( |
41 new FakeOutputSurface(software_device.Pass(), true)); | 57 new FakeOutputSurface(software_device.Pass(), true)); |
42 } | 58 } |
43 | 59 |
44 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; | 60 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; |
45 | 61 |
46 virtual const struct Capabilities& Capabilities() const OVERRIDE; | 62 virtual const struct Capabilities& Capabilities() const OVERRIDE; |
47 | 63 |
(...skipping 24 matching lines...) Expand all Loading... |
72 return FakeOutputSurface::Create3d( | 88 return FakeOutputSurface::Create3d( |
73 FakeWebGraphicsContext3D::Create( | 89 FakeWebGraphicsContext3D::Create( |
74 WebKit::WebGraphicsContext3D::Attributes()) | 90 WebKit::WebGraphicsContext3D::Attributes()) |
75 .PassAs<WebKit::WebGraphicsContext3D>()) | 91 .PassAs<WebKit::WebGraphicsContext3D>()) |
76 .PassAs<cc::OutputSurface>(); | 92 .PassAs<cc::OutputSurface>(); |
77 } | 93 } |
78 | 94 |
79 } // namespace cc | 95 } // namespace cc |
80 | 96 |
81 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 97 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |