Add git cl format presubmit warning for extension and apps.
[chromium-blink-merge.git] / cc / debug / debug_colors.cc
blob4e3f32e317d71b87a7b0bd74200454a7a459556a
1 // Copyright 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/debug/debug_colors.h"
7 #include "cc/trees/layer_tree_impl.h"
9 namespace cc {
11 static float Scale(float width, const LayerTreeImpl* tree_impl) {
12 return width * (tree_impl ? tree_impl->device_scale_factor() : 1);
15 // ======= Layer border colors =======
17 // Tiled content layers are orange.
18 SkColor DebugColors::TiledContentLayerBorderColor() {
19 return SkColorSetARGB(128, 255, 128, 0);
21 int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl* tree_impl) {
22 return Scale(2, tree_impl);
25 // Image layers are olive.
26 SkColor DebugColors::ImageLayerBorderColor() {
27 return SkColorSetARGB(128, 128, 128, 0);
29 int DebugColors::ImageLayerBorderWidth(const LayerTreeImpl* tree_impl) {
30 return Scale(2, tree_impl);
33 // Non-tiled content layers area green.
34 SkColor DebugColors::ContentLayerBorderColor() {
35 return SkColorSetARGB(128, 0, 128, 32);
37 int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl* tree_impl) {
38 return Scale(2, tree_impl);
41 // Masking layers are pale blue and wide.
42 SkColor DebugColors::MaskingLayerBorderColor() {
43 return SkColorSetARGB(48, 128, 255, 255);
45 int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl* tree_impl) {
46 return Scale(20, tree_impl);
49 // Other container layers are yellow.
50 SkColor DebugColors::ContainerLayerBorderColor() {
51 return SkColorSetARGB(192, 255, 255, 0);
53 int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl* tree_impl) {
54 return Scale(2, tree_impl);
57 // Surface layers are a blue-ish green.
58 SkColor DebugColors::SurfaceLayerBorderColor() {
59 return SkColorSetARGB(128, 0, 255, 136);
61 int DebugColors::SurfaceLayerBorderWidth(const LayerTreeImpl* tree_impl) {
62 return Scale(2, tree_impl);
65 // Render surfaces are blue.
66 SkColor DebugColors::SurfaceBorderColor() {
67 return SkColorSetARGB(100, 0, 0, 255);
69 int DebugColors::SurfaceBorderWidth(const LayerTreeImpl* tree_impl) {
70 return Scale(2, tree_impl);
73 // Replicas of render surfaces are purple.
74 SkColor DebugColors::SurfaceReplicaBorderColor() {
75 return SkColorSetARGB(100, 160, 0, 255);
77 int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl* tree_impl) {
78 return Scale(2, tree_impl);
81 // ======= Tile colors =======
83 // High-res tile borders are cyan.
84 SkColor DebugColors::HighResTileBorderColor() {
85 return SkColorSetARGB(100, 80, 200, 200);
87 int DebugColors::HighResTileBorderWidth(const LayerTreeImpl* tree_impl) {
88 return Scale(1, tree_impl);
91 // Low-res tile borders are purple.
92 SkColor DebugColors::LowResTileBorderColor() {
93 return SkColorSetARGB(100, 212, 83, 192);
95 int DebugColors::LowResTileBorderWidth(const LayerTreeImpl* tree_impl) {
96 return Scale(2, tree_impl);
99 // Other high-resolution tile borders are yellow.
100 SkColor DebugColors::ExtraHighResTileBorderColor() {
101 return SkColorSetARGB(100, 239, 231, 20);
103 int DebugColors::ExtraHighResTileBorderWidth(const LayerTreeImpl* tree_impl) {
104 return Scale(2, tree_impl);
107 // Other low-resolution tile borders are green.
108 SkColor DebugColors::ExtraLowResTileBorderColor() {
109 return SkColorSetARGB(100, 93, 186, 18);
111 int DebugColors::ExtraLowResTileBorderWidth(const LayerTreeImpl* tree_impl) {
112 return Scale(2, tree_impl);
115 // Missing tile borders are red.
116 SkColor DebugColors::MissingTileBorderColor() {
117 return SkColorSetARGB(100, 255, 0, 0);
119 int DebugColors::MissingTileBorderWidth(const LayerTreeImpl* tree_impl) {
120 return Scale(1, tree_impl);
123 // Culled tile borders are brown.
124 SkColor DebugColors::CulledTileBorderColor() {
125 return SkColorSetARGB(120, 160, 100, 0);
127 int DebugColors::CulledTileBorderWidth(const LayerTreeImpl* tree_impl) {
128 return Scale(1, tree_impl);
131 // Solid color tile borders are grey.
132 SkColor DebugColors::SolidColorTileBorderColor() {
133 return SkColorSetARGB(128, 128, 128, 128);
135 int DebugColors::SolidColorTileBorderWidth(const LayerTreeImpl* tree_impl) {
136 return Scale(1, tree_impl);
139 // Picture tile borders are dark grey.
140 SkColor DebugColors::PictureTileBorderColor() {
141 return SkColorSetARGB(64, 64, 64, 0);
143 int DebugColors::PictureTileBorderWidth(const LayerTreeImpl* tree_impl) {
144 return Scale(1, tree_impl);
147 // Direct picture borders are chartreuse.
148 SkColor DebugColors::DirectPictureBorderColor() {
149 return SkColorSetARGB(255, 127, 255, 0);
151 int DebugColors::DirectPictureBorderWidth(const LayerTreeImpl* tree_impl) {
152 return Scale(1, tree_impl);
155 // ======= Checkerboard colors =======
157 // Non-debug checkerboards are grey.
158 SkColor DebugColors::DefaultCheckerboardColor() {
159 return SkColorSetRGB(241, 241, 241);
162 // Invalidated tiles get sky blue checkerboards.
163 SkColor DebugColors::InvalidatedTileCheckerboardColor() {
164 return SkColorSetRGB(128, 200, 245);
167 // Evicted tiles get pale red checkerboards.
168 SkColor DebugColors::EvictedTileCheckerboardColor() {
169 return SkColorSetRGB(255, 200, 200);
172 // ======= Debug rect colors =======
174 // Paint rects in red.
175 SkColor DebugColors::PaintRectBorderColor() {
176 return SkColorSetARGB(255, 255, 0, 0);
178 int DebugColors::PaintRectBorderWidth() { return 2; }
179 SkColor DebugColors::PaintRectFillColor() {
180 return SkColorSetARGB(30, 255, 0, 0);
183 // Property-changed rects in blue.
184 SkColor DebugColors::PropertyChangedRectBorderColor() {
185 return SkColorSetARGB(255, 0, 0, 255);
187 int DebugColors::PropertyChangedRectBorderWidth() { return 2; }
188 SkColor DebugColors::PropertyChangedRectFillColor() {
189 return SkColorSetARGB(30, 0, 0, 255);
192 // Surface damage rects in yellow-orange.
193 SkColor DebugColors::SurfaceDamageRectBorderColor() {
194 return SkColorSetARGB(255, 200, 100, 0);
196 int DebugColors::SurfaceDamageRectBorderWidth() { return 2; }
197 SkColor DebugColors::SurfaceDamageRectFillColor() {
198 return SkColorSetARGB(30, 200, 100, 0);
201 // Surface replica screen space rects in green.
202 SkColor DebugColors::ScreenSpaceLayerRectBorderColor() {
203 return SkColorSetARGB(255, 100, 200, 0);
205 int DebugColors::ScreenSpaceLayerRectBorderWidth() { return 2; }
206 SkColor DebugColors::ScreenSpaceLayerRectFillColor() {
207 return SkColorSetARGB(30, 100, 200, 0);
210 // Layer screen space rects in purple.
211 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() {
212 return SkColorSetARGB(255, 100, 0, 200);
214 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth() { return 2; }
215 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() {
216 return SkColorSetARGB(10, 100, 0, 200);
219 // Occluding rects in pink.
220 SkColor DebugColors::OccludingRectBorderColor() {
221 return SkColorSetARGB(255, 245, 136, 255);
223 int DebugColors::OccludingRectBorderWidth() { return 2; }
224 SkColor DebugColors::OccludingRectFillColor() {
225 return SkColorSetARGB(10, 245, 136, 255);
228 // Non-Occluding rects in a reddish color.
229 SkColor DebugColors::NonOccludingRectBorderColor() {
230 return SkColorSetARGB(255, 200, 0, 100);
232 int DebugColors::NonOccludingRectBorderWidth() { return 2; }
233 SkColor DebugColors::NonOccludingRectFillColor() {
234 return SkColorSetARGB(10, 200, 0, 100);
237 // Touch-event-handler rects in yellow.
238 SkColor DebugColors::TouchEventHandlerRectBorderColor() {
239 return SkColorSetARGB(255, 239, 229, 60);
241 int DebugColors::TouchEventHandlerRectBorderWidth() { return 2; }
242 SkColor DebugColors::TouchEventHandlerRectFillColor() {
243 return SkColorSetARGB(30, 239, 229, 60);
246 // Wheel-event-handler rects in green.
247 SkColor DebugColors::WheelEventHandlerRectBorderColor() {
248 return SkColorSetARGB(255, 189, 209, 57);
250 int DebugColors::WheelEventHandlerRectBorderWidth() { return 2; }
251 SkColor DebugColors::WheelEventHandlerRectFillColor() {
252 return SkColorSetARGB(30, 189, 209, 57);
255 // Non-fast-scrollable rects in orange.
256 SkColor DebugColors::NonFastScrollableRectBorderColor() {
257 return SkColorSetARGB(255, 238, 163, 59);
259 int DebugColors::NonFastScrollableRectBorderWidth() { return 2; }
260 SkColor DebugColors::NonFastScrollableRectFillColor() {
261 return SkColorSetARGB(30, 238, 163, 59);
264 // Animation bounds are lime-green.
265 SkColor DebugColors::LayerAnimationBoundsBorderColor() {
266 return SkColorSetARGB(255, 112, 229, 0);
268 int DebugColors::LayerAnimationBoundsBorderWidth() { return 2; }
269 SkColor DebugColors::LayerAnimationBoundsFillColor() {
270 return SkColorSetARGB(30, 112, 229, 0);
273 // Non-Painted rects in cyan.
274 SkColor DebugColors::NonPaintedFillColor() { return SK_ColorCYAN; }
276 // Missing picture rects in magenta.
277 SkColor DebugColors::MissingPictureFillColor() { return SK_ColorMAGENTA; }
279 // Picture borders in transparent blue.
280 SkColor DebugColors::PictureBorderColor() {
281 return SkColorSetARGB(100, 0, 0, 200);
284 // ======= HUD widget colors =======
286 SkColor DebugColors::HUDBackgroundColor() {
287 return SkColorSetARGB(215, 17, 17, 17);
289 SkColor DebugColors::HUDSeparatorLineColor() {
290 return SkColorSetARGB(255, 130, 130, 130);
292 SkColor DebugColors::HUDIndicatorLineColor() {
293 return SkColorSetARGB(255, 80, 80, 80);
296 SkColor DebugColors::PlatformLayerTreeTextColor() { return SK_ColorRED; }
297 SkColor DebugColors::FPSDisplayTextAndGraphColor() { return SK_ColorRED; }
298 SkColor DebugColors::MemoryDisplayTextColor() {
299 return SkColorSetARGB(255, 220, 220, 220);
302 // Paint time display in green (similar to paint times in the WebInspector)
303 SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() {
304 return SkColorSetRGB(75, 155, 55);
307 } // namespace cc