compositor_switches.cc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 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.
  4. #include "ui/compositor/compositor_switches.h"
  5. #include "base/command_line.h"
  6. #include "build/build_config.h"
  7. #include "build/chromeos_buildflags.h"
  8. namespace switches {
  9. // Forces tests to produce pixel output when they normally wouldn't.
  10. const char kEnablePixelOutputInTests[] = "enable-pixel-output-in-tests";
  11. const char kUIEnableRGBA4444Textures[] = "ui-enable-rgba-4444-textures";
  12. const char kUIEnableZeroCopy[] = "ui-enable-zero-copy";
  13. const char kUIDisableZeroCopy[] = "ui-disable-zero-copy";
  14. const char kUIShowPaintRects[] = "ui-show-paint-rects";
  15. const char kUISlowAnimations[] = "ui-slow-animations";
  16. const char kDisableVsyncForTests[] = "disable-vsync-for-tests";
  17. } // namespace switches
  18. namespace features {
  19. // If enabled, all draw commands recorded on canvas are done in pixel aligned
  20. // measurements. This also enables scaling of all elements in views and layers
  21. // to be done via corner points. See https://crbug.com/720596 for details.
  22. const base::Feature kEnablePixelCanvasRecording {
  23. "enable-pixel-canvas-recording",
  24. #if BUILDFLAG(IS_CHROMEOS)
  25. base::FEATURE_ENABLED_BY_DEFAULT
  26. #else
  27. base::FEATURE_DISABLED_BY_DEFAULT
  28. #endif
  29. };
  30. } // namespace features
  31. namespace ui {
  32. bool IsUIZeroCopyEnabled() {
  33. // Match the behavior of IsZeroCopyUploadEnabled() in content/browser/gpu.
  34. const base::CommandLine& command_line =
  35. *base::CommandLine::ForCurrentProcess();
  36. #if BUILDFLAG(IS_APPLE)
  37. return !command_line.HasSwitch(switches::kUIDisableZeroCopy);
  38. #else
  39. return command_line.HasSwitch(switches::kUIEnableZeroCopy);
  40. #endif
  41. }
  42. bool IsPixelCanvasRecordingEnabled() {
  43. return base::FeatureList::IsEnabled(features::kEnablePixelCanvasRecording);
  44. }
  45. } // namespace ui