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/output_surface.h" | 10 #include "cc/output_surface.h" |
11 #include "cc/test/fake_software_output_device.h" | 11 #include "cc/test/fake_software_output_device.h" |
12 #include "cc/test/fake_web_graphics_context_3d.h" | 12 #include "cc/test/fake_web_graphics_context_3d.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class FakeOutputSurface : public OutputSurface { | 17 class FakeOutputSurface : public OutputSurface { |
18 public: | 18 public: |
19 virtual ~FakeOutputSurface(); | 19 virtual ~FakeOutputSurface(); |
20 | 20 |
21 static inline scoped_ptr<FakeOutputSurface> Create3d( | 21 static inline scoped_ptr<FakeOutputSurface> Create3d( |
22 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { | 22 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { |
23 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); | 23 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); |
24 } | 24 } |
25 | 25 |
26 static inline scoped_ptr<FakeOutputSurface> Create3d() { | |
27 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = | |
28 FakeWebGraphicsContext3D::Create( | |
29 WebKit::WebGraphicsContext3D::Attributes()) | |
30 .PassAs<WebKit::WebGraphicsContext3D>(); | |
31 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); | |
32 } | |
33 | |
34 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( | 26 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( |
35 scoped_ptr<SoftwareOutputDevice> software_device) { | 27 scoped_ptr<SoftwareOutputDevice> software_device) { |
36 return make_scoped_ptr( | 28 return make_scoped_ptr( |
37 new FakeOutputSurface(software_device.Pass(), false)); | 29 new FakeOutputSurface(software_device.Pass(), false)); |
38 } | 30 } |
39 | 31 |
40 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 32 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
41 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { | 33 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { |
42 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); | 34 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); |
43 } | 35 } |
44 | 36 |
45 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d() { | |
46 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = | |
47 FakeWebGraphicsContext3D::Create( | |
48 WebKit::WebGraphicsContext3D::Attributes()) | |
49 .PassAs<WebKit::WebGraphicsContext3D>(); | |
50 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); | |
51 } | |
52 | |
53 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( | 37 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( |
54 scoped_ptr<SoftwareOutputDevice> software_device) { | 38 scoped_ptr<SoftwareOutputDevice> software_device) { |
55 return make_scoped_ptr( | 39 return make_scoped_ptr( |
56 new FakeOutputSurface(software_device.Pass(), true)); | 40 new FakeOutputSurface(software_device.Pass(), true)); |
57 } | 41 } |
58 | 42 |
59 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; | 43 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; |
60 | 44 |
61 virtual const struct Capabilities& Capabilities() const OVERRIDE; | 45 virtual const struct Capabilities& Capabilities() const OVERRIDE; |
62 | 46 |
(...skipping 19 matching lines...) Expand all Loading... |
82 return FakeOutputSurface::Create3d( | 66 return FakeOutputSurface::Create3d( |
83 FakeWebGraphicsContext3D::Create( | 67 FakeWebGraphicsContext3D::Create( |
84 WebKit::WebGraphicsContext3D::Attributes()) | 68 WebKit::WebGraphicsContext3D::Attributes()) |
85 .PassAs<WebKit::WebGraphicsContext3D>()) | 69 .PassAs<WebKit::WebGraphicsContext3D>()) |
86 .PassAs<cc::OutputSurface>(); | 70 .PassAs<cc::OutputSurface>(); |
87 } | 71 } |
88 | 72 |
89 } // namespace cc | 73 } // namespace cc |
90 | 74 |
91 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 75 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |