| 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 |
| 26 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( | 34 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( |
| 27 scoped_ptr<SoftwareOutputDevice> software_device) { | 35 scoped_ptr<SoftwareOutputDevice> software_device) { |
| 28 return make_scoped_ptr( | 36 return make_scoped_ptr( |
| 29 new FakeOutputSurface(software_device.Pass(), false)); | 37 new FakeOutputSurface(software_device.Pass(), false)); |
| 30 } | 38 } |
| 31 | 39 |
| 32 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 40 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
| 33 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { | 41 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { |
| 34 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); | 42 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); |
| 35 } | 43 } |
| 36 | 44 |
| 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 |
| 37 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( | 53 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( |
| 38 scoped_ptr<SoftwareOutputDevice> software_device) { | 54 scoped_ptr<SoftwareOutputDevice> software_device) { |
| 39 return make_scoped_ptr( | 55 return make_scoped_ptr( |
| 40 new FakeOutputSurface(software_device.Pass(), true)); | 56 new FakeOutputSurface(software_device.Pass(), true)); |
| 41 } | 57 } |
| 42 | 58 |
| 43 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; | 59 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; |
| 44 | 60 |
| 45 virtual const struct Capabilities& Capabilities() const OVERRIDE; | 61 virtual const struct Capabilities& Capabilities() const OVERRIDE; |
| 46 | 62 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 66 return FakeOutputSurface::Create3d( | 82 return FakeOutputSurface::Create3d( |
| 67 FakeWebGraphicsContext3D::Create( | 83 FakeWebGraphicsContext3D::Create( |
| 68 WebKit::WebGraphicsContext3D::Attributes()) | 84 WebKit::WebGraphicsContext3D::Attributes()) |
| 69 .PassAs<WebKit::WebGraphicsContext3D>()) | 85 .PassAs<WebKit::WebGraphicsContext3D>()) |
| 70 .PassAs<cc::OutputSurface>(); | 86 .PassAs<cc::OutputSurface>(); |
| 71 } | 87 } |
| 72 | 88 |
| 73 } // namespace cc | 89 } // namespace cc |
| 74 | 90 |
| 75 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 91 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| OLD | NEW |