| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/compositor/compositor_util.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "cc/base/switches.h" |
| 9 #include "cc/output/renderer_settings.h" |
| 10 #include "ui/compositor/compositor_switches.h" |
| 11 #include "ui/display/display_switches.h" |
| 12 #include "ui/gfx/switches.h" |
| 13 |
| 14 namespace ui { |
| 15 |
| 16 void InitializeRendererSettings( |
| 17 const base::Callback<uint32_t(gfx::BufferFormat, gfx::BufferUsage)>& |
| 18 texture_target_callback, |
| 19 cc::RendererSettings* renderer_settings) { |
| 20 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 21 renderer_settings->partial_swap_enabled = |
| 22 !command_line->HasSwitch(switches::kUIDisablePartialSwap); |
| 23 #if defined(OS_WIN) |
| 24 renderer_settings->finish_rendering_on_resize = true; |
| 25 #elif defined(OS_MACOSX) |
| 26 renderer_settings->release_overlay_resources_after_gpu_query = true; |
| 27 #endif |
| 28 renderer_settings->gl_composited_texture_quad_border = |
| 29 command_line->HasSwitch(cc::switches::kGlCompositedTextureQuadBorder); |
| 30 renderer_settings->show_overdraw_feedback = |
| 31 command_line->HasSwitch(cc::switches::kShowOverdrawFeedback); |
| 32 if (command_line->HasSwitch(switches::kUIEnableRGBA4444Textures)) |
| 33 renderer_settings->preferred_tile_format = cc::RGBA_4444; |
| 34 renderer_settings->enable_color_correct_rendering = |
| 35 command_line->HasSwitch(switches::kEnableColorCorrectRendering) || |
| 36 command_line->HasSwitch(switches::kEnableHDR); |
| 37 // Populate buffer_to_texture_target_map for all buffer usage/formats. |
| 38 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST); |
| 39 ++usage_idx) { |
| 40 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx); |
| 41 for (int format_idx = 0; |
| 42 format_idx <= static_cast<int>(gfx::BufferFormat::LAST); |
| 43 ++format_idx) { |
| 44 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx); |
| 45 renderer_settings |
| 46 ->buffer_to_texture_target_map[std::make_pair(usage, format)] = |
| 47 texture_target_callback.Run(format, usage); |
| 48 } |
| 49 } |
| 50 renderer_settings->disallow_non_exact_resource_reuse = |
| 51 command_line->HasSwitch(cc::switches::kDisallowNonExactResourceReuse); |
| 52 } |
| 53 |
| 54 } // namespace ui |
| OLD | NEW |