OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/aura/mus/mus_context_factory.h" | 5 #include "ui/aura/mus/mus_context_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "cc/base/switches.h" | 9 #include "cc/base/switches.h" |
10 #include "services/ui/public/cpp/gpu/gpu.h" | 10 #include "services/ui/public/cpp/gpu/gpu.h" |
11 #include "ui/aura/mus/window_port_mus.h" | 11 #include "ui/aura/mus/window_port_mus.h" |
12 #include "ui/aura/window_tree_host.h" | 12 #include "ui/aura/window_tree_host.h" |
13 #include "ui/compositor/compositor_switches.h" | 13 #include "ui/compositor/compositor_switches.h" |
14 #include "ui/compositor/compositor_util.h" | 14 #include "ui/compositor/compositor_util.h" |
15 #include "ui/display/display_switches.h" | 15 #include "ui/display/display_switches.h" |
16 #include "ui/gfx/switches.h" | 16 #include "ui/gfx/switches.h" |
17 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 | 20 |
21 cc::BufferToTextureTargetMap CreateBufferToTextureTargetMap() { | |
sadrul
2017/07/05 15:21:36
Put in anon namespace.
sujith
2017/07/06 09:11:30
Done.
| |
22 cc::BufferToTextureTargetMap image_targets; | |
23 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST); | |
24 ++usage_idx) { | |
25 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx); | |
26 for (int format_idx = 0; | |
27 format_idx <= static_cast<int>(gfx::BufferFormat::LAST); | |
28 ++format_idx) { | |
29 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx); | |
30 // TODO(sad): http://crbug.com/675431 | |
31 image_targets[std::make_pair(usage, format)] = GL_TEXTURE_2D; | |
32 } | |
33 } | |
34 return image_targets; | |
35 } | |
36 | |
21 MusContextFactory::MusContextFactory(ui::Gpu* gpu) | 37 MusContextFactory::MusContextFactory(ui::Gpu* gpu) |
22 : gpu_(gpu), | 38 : gpu_(gpu), |
23 renderer_settings_(ui::CreateRendererSettings( | 39 renderer_settings_( |
24 [](gfx::BufferFormat format, gfx::BufferUsage usage) -> uint32_t { | 40 ui::CreateRendererSettings(CreateBufferToTextureTargetMap())), |
25 // TODO(sad): http://crbug.com/675431 | |
26 return GL_TEXTURE_2D; | |
27 })), | |
28 weak_ptr_factory_(this) {} | 41 weak_ptr_factory_(this) {} |
29 | 42 |
30 MusContextFactory::~MusContextFactory() {} | 43 MusContextFactory::~MusContextFactory() {} |
31 | 44 |
32 void MusContextFactory::OnEstablishedGpuChannel( | 45 void MusContextFactory::OnEstablishedGpuChannel( |
33 base::WeakPtr<ui::Compositor> compositor, | 46 base::WeakPtr<ui::Compositor> compositor, |
34 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { | 47 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { |
35 if (!compositor) | 48 if (!compositor) |
36 return; | 49 return; |
37 WindowTreeHost* host = | 50 WindowTreeHost* host = |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 | 92 |
80 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { | 93 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { |
81 return raster_thread_helper_.task_graph_runner(); | 94 return raster_thread_helper_.task_graph_runner(); |
82 } | 95 } |
83 | 96 |
84 const cc::ResourceSettings& MusContextFactory::GetResourceSettings() const { | 97 const cc::ResourceSettings& MusContextFactory::GetResourceSettings() const { |
85 return renderer_settings_.resource_settings; | 98 return renderer_settings_.resource_settings; |
86 } | 99 } |
87 | 100 |
88 } // namespace aura | 101 } // namespace aura |
OLD | NEW |