| 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 #include "cc/test/fake_layer_tree_host_client.h" | 5 #include "cc/test/fake_layer_tree_host_client.h" |
| 6 | 6 |
| 7 #include "cc/output/context_provider.h" | 7 #include "cc/output/context_provider.h" |
| 8 #include "cc/test/fake_output_surface.h" | 8 #include "cc/test/fake_output_surface.h" |
| 9 #include "cc/test/test_web_graphics_context_3d.h" | 9 #include "cc/test/test_web_graphics_context_3d.h" |
| 10 #include "cc/trees/layer_tree_host.h" | |
| 11 | 10 |
| 12 namespace cc { | 11 namespace cc { |
| 13 | 12 |
| 14 FakeLayerTreeHostClient::FakeLayerTreeHostClient(RendererOptions options) | 13 FakeLayerTreeHostClient::FakeLayerTreeHostClient(RendererOptions options) |
| 15 : use_software_rendering_(options == DIRECT_SOFTWARE || | 14 : use_software_rendering_(options == DIRECT_SOFTWARE || |
| 16 options == DELEGATED_SOFTWARE), | 15 options == DELEGATED_SOFTWARE), |
| 17 use_delegating_renderer_(options == DELEGATED_3D || | 16 use_delegating_renderer_(options == DELEGATED_3D || |
| 18 options == DELEGATED_SOFTWARE), | 17 options == DELEGATED_SOFTWARE) {} |
| 19 host_(NULL) { | |
| 20 } | |
| 21 | 18 |
| 22 FakeLayerTreeHostClient::~FakeLayerTreeHostClient() {} | 19 FakeLayerTreeHostClient::~FakeLayerTreeHostClient() {} |
| 23 | 20 |
| 24 void FakeLayerTreeHostClient::RequestNewOutputSurface(bool fallback) { | 21 scoped_ptr<OutputSurface> FakeLayerTreeHostClient::CreateOutputSurface( |
| 25 DCHECK(host_); | 22 bool fallback) { |
| 26 scoped_ptr<OutputSurface> surface; | |
| 27 if (use_software_rendering_) { | 23 if (use_software_rendering_) { |
| 28 if (use_delegating_renderer_) { | 24 if (use_delegating_renderer_) { |
| 29 surface = FakeOutputSurface::CreateDelegatingSoftware( | 25 return FakeOutputSurface::CreateDelegatingSoftware( |
| 30 make_scoped_ptr(new SoftwareOutputDevice)) | 26 make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>(); |
| 31 .PassAs<OutputSurface>(); | |
| 32 } else { | |
| 33 surface = FakeOutputSurface::CreateSoftware( | |
| 34 make_scoped_ptr(new SoftwareOutputDevice)) | |
| 35 .PassAs<OutputSurface>(); | |
| 36 } | 27 } |
| 37 } else if (use_delegating_renderer_) { | 28 |
| 38 surface = FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>(); | 29 return FakeOutputSurface::CreateSoftware( |
| 39 } else { | 30 make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>(); |
| 40 surface = FakeOutputSurface::Create3d().PassAs<OutputSurface>(); | |
| 41 } | 31 } |
| 42 host_->SetOutputSurface(surface.Pass()); | 32 |
| 33 if (use_delegating_renderer_) |
| 34 return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>(); |
| 35 return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); |
| 43 } | 36 } |
| 44 | 37 |
| 45 } // namespace cc | 38 } // namespace cc |
| OLD | NEW |