Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: ui/compositor/compositor_util.cc

Issue 2895273002: Unified the use of BufferToTextureTargetMap for all the Processes (Closed)
Patch Set: nit taken care Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/compositor/compositor_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/compositor/compositor_util.h" 5 #include "ui/compositor/compositor_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "cc/base/switches.h" 8 #include "cc/base/switches.h"
9 #include "cc/output/renderer_settings.h" 9 #include "cc/output/renderer_settings.h"
10 #include "ui/compositor/compositor_switches.h" 10 #include "ui/compositor/compositor_switches.h"
11 #include "ui/display/display_switches.h" 11 #include "ui/display/display_switches.h"
12 #include "ui/gfx/color_space_switches.h" 12 #include "ui/gfx/color_space_switches.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 cc::RendererSettings CreateRendererSettings(uint32_t ( 16 cc::RendererSettings CreateRendererSettings(
17 *get_texture_target)(gfx::BufferFormat format, gfx::BufferUsage usage)) { 17 const cc::BufferToTextureTargetMap& image_targets) {
18 cc::RendererSettings renderer_settings; 18 cc::RendererSettings renderer_settings;
19 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 19 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
20 renderer_settings.partial_swap_enabled = 20 renderer_settings.partial_swap_enabled =
21 !command_line->HasSwitch(switches::kUIDisablePartialSwap); 21 !command_line->HasSwitch(switches::kUIDisablePartialSwap);
22 #if defined(OS_WIN) 22 #if defined(OS_WIN)
23 renderer_settings.finish_rendering_on_resize = true; 23 renderer_settings.finish_rendering_on_resize = true;
24 #elif defined(OS_MACOSX) 24 #elif defined(OS_MACOSX)
25 renderer_settings.release_overlay_resources_after_gpu_query = true; 25 renderer_settings.release_overlay_resources_after_gpu_query = true;
26 #endif 26 #endif
27 renderer_settings.gl_composited_texture_quad_border = 27 renderer_settings.gl_composited_texture_quad_border =
28 command_line->HasSwitch(cc::switches::kGlCompositedTextureQuadBorder); 28 command_line->HasSwitch(cc::switches::kGlCompositedTextureQuadBorder);
29 renderer_settings.show_overdraw_feedback = 29 renderer_settings.show_overdraw_feedback =
30 command_line->HasSwitch(cc::switches::kShowOverdrawFeedback); 30 command_line->HasSwitch(cc::switches::kShowOverdrawFeedback);
31 renderer_settings.enable_color_correct_rendering = 31 renderer_settings.enable_color_correct_rendering =
32 base::FeatureList::IsEnabled(features::kColorCorrectRendering) || 32 base::FeatureList::IsEnabled(features::kColorCorrectRendering) ||
33 command_line->HasSwitch(switches::kEnableHDR); 33 command_line->HasSwitch(switches::kEnableHDR);
34 // Populate buffer_to_texture_target_map for all buffer usage/formats. 34 renderer_settings.resource_settings.buffer_to_texture_target_map =
35 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST); 35 image_targets;
36 ++usage_idx) { 36
37 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
38 for (int format_idx = 0;
39 format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
40 ++format_idx) {
41 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
42 renderer_settings.resource_settings
43 .buffer_to_texture_target_map[std::make_pair(usage, format)] =
44 get_texture_target(format, usage);
45 }
46 }
47 renderer_settings.disallow_non_exact_resource_reuse = 37 renderer_settings.disallow_non_exact_resource_reuse =
48 command_line->HasSwitch(cc::switches::kDisallowNonExactResourceReuse); 38 command_line->HasSwitch(cc::switches::kDisallowNonExactResourceReuse);
49 renderer_settings.allow_antialiasing = 39 renderer_settings.allow_antialiasing =
50 !command_line->HasSwitch(cc::switches::kDisableCompositedAntialiasing); 40 !command_line->HasSwitch(cc::switches::kDisableCompositedAntialiasing);
51 41
52 return renderer_settings; 42 return renderer_settings;
53 } 43 }
54 44
55 } // namespace ui 45 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698