Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / cc / test / fake_layer_tree_host_client.cc
blob975f6878cc5dff1ffa499b4271aec19359222f78
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.
5 #include "cc/test/fake_layer_tree_host_client.h"
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"
11 namespace cc {
13 FakeLayerTreeHostClient::FakeLayerTreeHostClient(RendererOptions options)
14 : use_software_rendering_(options == DIRECT_SOFTWARE ||
15 options == DELEGATED_SOFTWARE),
16 use_delegating_renderer_(options == DELEGATED_3D ||
17 options == DELEGATED_SOFTWARE) {}
19 FakeLayerTreeHostClient::~FakeLayerTreeHostClient() {}
21 scoped_ptr<OutputSurface> FakeLayerTreeHostClient::CreateOutputSurface(
22 bool fallback) {
23 if (use_software_rendering_) {
24 if (use_delegating_renderer_) {
25 return FakeOutputSurface::CreateDelegatingSoftware(
26 make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>();
29 return FakeOutputSurface::CreateSoftware(
30 make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>();
33 if (use_delegating_renderer_)
34 return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>();
35 return FakeOutputSurface::Create3d().PassAs<OutputSurface>();
38 } // namespace cc