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