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

Unified Diff: ui/compositor/compositor_util.cc

Issue 2879463002: Initialize RendererSettings in ContextFactory (Closed)
Patch Set: const RendererSettings Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/compositor_util.h ('k') | ui/compositor/test/fake_context_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor_util.cc
diff --git a/ui/compositor/compositor_util.cc b/ui/compositor/compositor_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..39109bc92dbefa09be71172323d15dd5ee8fd85e
--- /dev/null
+++ b/ui/compositor/compositor_util.cc
@@ -0,0 +1,55 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/compositor/compositor_util.h"
+
+#include "base/command_line.h"
+#include "cc/base/switches.h"
+#include "cc/output/renderer_settings.h"
+#include "ui/compositor/compositor_switches.h"
+#include "ui/display/display_switches.h"
+#include "ui/gfx/switches.h"
+
+namespace ui {
+
+cc::RendererSettings CreateRendererSettings(uint32_t (
+ *get_texture_target)(gfx::BufferFormat format, gfx::BufferUsage usage)) {
+ cc::RendererSettings renderer_settings;
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ renderer_settings.partial_swap_enabled =
+ !command_line->HasSwitch(switches::kUIDisablePartialSwap);
+#if defined(OS_WIN)
+ renderer_settings.finish_rendering_on_resize = true;
+#elif defined(OS_MACOSX)
+ renderer_settings.release_overlay_resources_after_gpu_query = true;
+#endif
+ renderer_settings.gl_composited_texture_quad_border =
+ command_line->HasSwitch(cc::switches::kGlCompositedTextureQuadBorder);
+ renderer_settings.show_overdraw_feedback =
+ command_line->HasSwitch(cc::switches::kShowOverdrawFeedback);
+ if (command_line->HasSwitch(switches::kUIEnableRGBA4444Textures))
+ renderer_settings.preferred_tile_format = cc::RGBA_4444;
+ renderer_settings.enable_color_correct_rendering =
+ command_line->HasSwitch(switches::kEnableColorCorrectRendering) ||
+ command_line->HasSwitch(switches::kEnableHDR);
+ // Populate buffer_to_texture_target_map for all buffer usage/formats.
+ for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST);
+ ++usage_idx) {
+ gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
+ for (int format_idx = 0;
+ format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
+ ++format_idx) {
+ gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
+ renderer_settings
+ .buffer_to_texture_target_map[std::make_pair(usage, format)] =
+ get_texture_target(format, usage);
+ }
+ }
+ renderer_settings.disallow_non_exact_resource_reuse =
+ command_line->HasSwitch(cc::switches::kDisallowNonExactResourceReuse);
+
+ return renderer_settings;
+}
+
+} // namespace ui
« no previous file with comments | « ui/compositor/compositor_util.h ('k') | ui/compositor/test/fake_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698