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.
5 #include "cc/base/switches.h"
7 #include "base/command_line.h"
12 // On platforms where checkerboards are used, prefer background colors instead
14 const char kBackgroundColorInsteadOfCheckerboard
[] =
15 "background-color-instead-of-checkerboard";
18 const char kDisableLCDText
[] = "disable-lcd-text";
20 const char kDisableThreadedAnimation
[] = "disable-threaded-animation";
22 // Disables layer-edge anti-aliasing in the compositor.
23 const char kDisableCompositedAntialiasing
[] =
24 "disable-composited-antialiasing";
26 // Paint content on the main thread instead of the compositor thread.
27 // Overrides the kEnableImplSidePainting flag.
28 const char kDisableImplSidePainting
[] = "disable-impl-side-painting";
31 const char kEnableLCDText
[] = "enable-lcd-text";
33 // Paint content on the compositor thread instead of the main thread.
34 const char kEnableImplSidePainting
[] = "enable-impl-side-painting";
36 const char kEnableTopControlsPositionCalculation
[] =
37 "enable-top-controls-position-calculation";
39 // For any layers that can get drawn directly to screen, draw them with the Skia
40 // GPU backend. Only valid with gl rendering + threaded compositing + impl-side
42 const char kForceDirectLayerDrawing
[] = "force-direct-layer-drawing";
44 // The height of the movable top controls.
45 const char kTopControlsHeight
[] = "top-controls-height";
47 // Percentage of the top controls need to be hidden before they will auto hide.
48 const char kTopControlsHideThreshold
[] = "top-controls-hide-threshold";
50 // Percentage of the top controls need to be shown before they will auto show.
51 const char kTopControlsShowThreshold
[] = "top-controls-show-threshold";
53 // Number of worker threads used to rasterize content.
54 const char kNumRasterThreads
[] = "num-raster-threads";
56 // Show metrics about overdraw in about:tracing recordings, such as the number
57 // of pixels culled, and the number of pixels drawn, for each frame.
58 const char kTraceOverdraw
[] = "trace-overdraw";
60 // Re-rasters everything multiple times to simulate a much slower machine.
61 // Give a scale factor to cause raster to take that many times longer to
62 // complete, such as --slow-down-raster-scale-factor=25.
63 const char kSlowDownRasterScaleFactor
[] = "slow-down-raster-scale-factor";
65 // The scale factor for low resolution tile contents.
66 const char kLowResolutionContentsScaleFactor
[] =
67 "low-resolution-contents-scale-factor";
69 // Max tiles allowed for each tilings interest area.
70 const char kMaxTilesForInterestArea
[] = "max-tiles-for-interest-area";
72 // The amount of unused resource memory compositor is allowed to keep around.
73 const char kMaxUnusedResourceMemoryUsagePercentage
[] =
74 "max-unused-resource-memory-usage-percentage";
76 // Causes the compositor to render to textures which are then sent to the parent
77 // through the texture mailbox mechanism.
78 // Requires --enable-compositor-frame-message.
79 const char kCompositeToMailbox
[] = "composite-to-mailbox";
81 // Check that property changes during paint do not occur.
82 const char kStrictLayerPropertyChangeChecking
[] =
83 "strict-layer-property-change-checking";
85 // Virtual viewport for fixed-position elements, scrollbars during pinch.
86 const char kEnablePinchVirtualViewport
[] = "enable-pinch-virtual-viewport";
88 const char kEnablePartialSwap
[] = "enable-partial-swap";
89 // Disable partial swap which is needed for some OpenGL drivers / emulators.
90 const char kUIDisablePartialSwap
[] = "ui-disable-partial-swap";
92 const char kEnablePerTilePainting
[] = "enable-per-tile-painting";
93 const char kUIEnablePerTilePainting
[] = "ui-enable-per-tile-painting";
95 // Renders a border around compositor layers to help debug and study
97 const char kShowCompositedLayerBorders
[] = "show-composited-layer-borders";
98 const char kUIShowCompositedLayerBorders
[] = "ui-show-layer-borders";
100 // Draws a FPS indicator
101 const char kShowFPSCounter
[] = "show-fps-counter";
102 const char kUIShowFPSCounter
[] = "ui-show-fps-counter";
104 // Show rects in the HUD around layers whose properties have changed.
105 const char kShowPropertyChangedRects
[] = "show-property-changed-rects";
106 const char kUIShowPropertyChangedRects
[] = "ui-show-property-changed-rects";
108 // Show rects in the HUD around damage as it is recorded into each render
110 const char kShowSurfaceDamageRects
[] = "show-surface-damage-rects";
111 const char kUIShowSurfaceDamageRects
[] = "ui-show-surface-damage-rects";
113 // Show rects in the HUD around the screen-space transformed bounds of every
115 const char kShowScreenSpaceRects
[] = "show-screenspace-rects";
116 const char kUIShowScreenSpaceRects
[] = "ui-show-screenspace-rects";
118 // Show rects in the HUD around the screen-space transformed bounds of every
119 // layer's replica, when they have one.
120 const char kShowReplicaScreenSpaceRects
[] = "show-replica-screenspace-rects";
121 const char kUIShowReplicaScreenSpaceRects
[] =
122 "ui-show-replica-screenspace-rects";
124 // Show rects in the HUD wherever something is known to be drawn opaque and is
125 // considered occluding the pixels behind it.
126 const char kShowOccludingRects
[] = "show-occluding-rects";
127 const char kUIShowOccludingRects
[] = "ui-show-occluding-rects";
129 // Show rects in the HUD wherever something is not known to be drawn opaque and
130 // is not considered to be occluding the pixels behind it.
131 const char kShowNonOccludingRects
[] = "show-nonoccluding-rects";
132 const char kUIShowNonOccludingRects
[] = "ui-show-nonoccluding-rects";
134 // Enable rasterizer that writes directly to GPU memory.
135 const char kEnableMapImage
[] = "enable-map-image";
137 // Disable rasterizer that writes directly to GPU memory.
138 // Overrides the kEnableMapImage flag.
139 const char kDisableMapImage
[] = "disable-map-image";
141 // Prevents the layer tree unit tests from timing out.
142 const char kCCLayerTreeTestNoTimeout
[] = "cc-layer-tree-test-no-timeout";
144 // Disable textures using RGBA_4444 layout.
145 const char kDisable4444Textures
[] = "disable-4444-textures";
147 bool IsLCDTextEnabled() {
148 const CommandLine
* command_line
= CommandLine::ForCurrentProcess();
149 if (command_line
->HasSwitch(cc::switches::kDisableLCDText
))
151 else if (command_line
->HasSwitch(cc::switches::kEnableLCDText
))
154 #if defined(OS_ANDROID)
161 bool IsImplSidePaintingEnabled() {
162 const CommandLine
& command_line
= *CommandLine::ForCurrentProcess();
164 if (command_line
.HasSwitch(cc::switches::kDisableImplSidePainting
))
166 else if (command_line
.HasSwitch(cc::switches::kEnableImplSidePainting
))
169 #if defined(OS_ANDROID)
176 bool IsMapImageEnabled() {
177 const CommandLine
& command_line
= *CommandLine::ForCurrentProcess();
179 if (command_line
.HasSwitch(cc::switches::kDisableMapImage
))
181 else if (command_line
.HasSwitch(cc::switches::kEnableMapImage
))
187 } // namespace switches