summaryrefslogtreecommitdiffstats
path: root/chromium/cc/debug/debug_colors.cc
blob: 6cbbfe9431d6104a814df11d927eeb1d67c03953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
// Copyright 2012 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 "base/macros.h"

#include "cc/debug/debug_colors.h"

#include "cc/trees/layer_tree_impl.h"

namespace cc {

static float Scale(float width, const LayerTreeImpl* tree_impl) {
  return width * (tree_impl ? tree_impl->device_scale_factor() : 1);
}

// ======= Layer border colors =======

// Tiled content layers are orange.
SkColor DebugColors::TiledContentLayerBorderColor() {
  return SkColorSetARGB(128, 255, 128, 0);
}
int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Image layers are olive.
SkColor DebugColors::ImageLayerBorderColor() {
  return SkColorSetARGB(128, 128, 128, 0);
}
int DebugColors::ImageLayerBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Non-tiled content layers area green.
SkColor DebugColors::ContentLayerBorderColor() {
  return SkColorSetARGB(128, 0, 128, 32);
}
int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Masking layers are pale blue and wide.
SkColor DebugColors::MaskingLayerBorderColor() {
  return SkColorSetARGB(48, 128, 255, 255);
}
int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(20, tree_impl);
}

// Other container layers are yellow.
SkColor DebugColors::ContainerLayerBorderColor() {
  return SkColorSetARGB(192, 255, 255, 0);
}
int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Surface layers are a blue-ish green.
SkColor DebugColors::SurfaceLayerBorderColor() {
  return SkColorSetARGB(128, 0, 255, 136);
}
int DebugColors::SurfaceLayerBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Render surfaces are blue.
SkColor DebugColors::SurfaceBorderColor() {
  return SkColorSetARGB(100, 0, 0, 255);
}
int DebugColors::SurfaceBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Replicas of render surfaces are purple.
SkColor DebugColors::SurfaceReplicaBorderColor() {
  return SkColorSetARGB(100, 160, 0, 255);
}
int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// ======= Tile colors =======

// High-res tile borders are cyan.
SkColor DebugColors::HighResTileBorderColor() {
  return SkColorSetARGB(100, 80, 200, 200);
}
int DebugColors::HighResTileBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(1, tree_impl);
}

// Low-res tile borders are purple.
SkColor DebugColors::LowResTileBorderColor() {
  return SkColorSetARGB(100, 212, 83, 192);
}
int DebugColors::LowResTileBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Other high-resolution tile borders are yellow.
SkColor DebugColors::ExtraHighResTileBorderColor() {
  return SkColorSetARGB(100, 239, 231, 20);
}
int DebugColors::ExtraHighResTileBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Other low-resolution tile borders are green.
SkColor DebugColors::ExtraLowResTileBorderColor() {
  return SkColorSetARGB(100, 93, 186, 18);
}
int DebugColors::ExtraLowResTileBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(2, tree_impl);
}

// Missing tile borders are red.
SkColor DebugColors::MissingTileBorderColor() {
  return SkColorSetARGB(100, 255, 0, 0);
}
int DebugColors::MissingTileBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(1, tree_impl);
}

// Solid color tile borders are grey.
SkColor DebugColors::SolidColorTileBorderColor() {
  return SkColorSetARGB(128, 128, 128, 128);
}
int DebugColors::SolidColorTileBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(1, tree_impl);
}

// Picture tile borders are dark grey.
SkColor DebugColors::PictureTileBorderColor() {
  return SkColorSetARGB(64, 64, 64, 0);
}
int DebugColors::PictureTileBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(1, tree_impl);
}

// Direct picture borders are chartreuse.
SkColor DebugColors::DirectPictureBorderColor() {
  return SkColorSetARGB(255, 127, 255, 0);
}
int DebugColors::DirectPictureBorderWidth(const LayerTreeImpl* tree_impl) {
  return Scale(1, tree_impl);
}

// ======= Checkerboard colors =======

// Non-debug checkerboards are grey.
SkColor DebugColors::DefaultCheckerboardColor() {
  return SkColorSetRGB(241, 241, 241);
}

// Invalidated tiles get sky blue checkerboards.
SkColor DebugColors::InvalidatedTileCheckerboardColor() {
  return SkColorSetRGB(128, 200, 245);
}

// Evicted tiles get pale red checkerboards.
SkColor DebugColors::EvictedTileCheckerboardColor() {
  return SkColorSetRGB(255, 200, 200);
}

// ======= Debug rect colors =======

static SkColor FadedGreen(int initial_value, int step) {
  DCHECK_GE(step, 0);
  DCHECK_LE(step, DebugColors::kFadeSteps);
  int value = step * initial_value / DebugColors::kFadeSteps;
  return SkColorSetARGB(value, 0, 195, 0);
}
// Paint rects in green.
SkColor DebugColors::PaintRectBorderColor(int step) {
  return FadedGreen(255, step);
}
int DebugColors::PaintRectBorderWidth() { return 2; }
SkColor DebugColors::PaintRectFillColor(int step) {
  return FadedGreen(60, step);
}

// Property-changed rects in blue.
SkColor DebugColors::PropertyChangedRectBorderColor() {
  return SkColorSetARGB(255, 0, 0, 255);
}
int DebugColors::PropertyChangedRectBorderWidth() { return 2; }
SkColor DebugColors::PropertyChangedRectFillColor() {
  return SkColorSetARGB(30, 0, 0, 255);
}

// Surface damage rects in yellow-orange.
SkColor DebugColors::SurfaceDamageRectBorderColor() {
  return SkColorSetARGB(255, 200, 100, 0);
}
int DebugColors::SurfaceDamageRectBorderWidth() { return 2; }
SkColor DebugColors::SurfaceDamageRectFillColor() {
  return SkColorSetARGB(30, 200, 100, 0);
}

// Surface replica screen space rects in green.
SkColor DebugColors::ScreenSpaceLayerRectBorderColor() {
  return SkColorSetARGB(255, 100, 200, 0);
}
int DebugColors::ScreenSpaceLayerRectBorderWidth() { return 2; }
SkColor DebugColors::ScreenSpaceLayerRectFillColor() {
  return SkColorSetARGB(30, 100, 200, 0);
}

// Layer screen space rects in purple.
SkColor DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() {
  return SkColorSetARGB(255, 100, 0, 200);
}
int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth() { return 2; }
SkColor DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() {
  return SkColorSetARGB(10, 100, 0, 200);
}

// Occluding rects in pink.
SkColor DebugColors::OccludingRectBorderColor() {
  return SkColorSetARGB(255, 245, 136, 255);
}
int DebugColors::OccludingRectBorderWidth() { return 2; }
SkColor DebugColors::OccludingRectFillColor() {
  return SkColorSetARGB(10, 245, 136, 255);
}

// Non-Occluding rects in a reddish color.
SkColor DebugColors::NonOccludingRectBorderColor() {
  return SkColorSetARGB(255, 200, 0, 100);
}
int DebugColors::NonOccludingRectBorderWidth() { return 2; }
SkColor DebugColors::NonOccludingRectFillColor() {
  return SkColorSetARGB(10, 200, 0, 100);
}

// Touch-event-handler rects in yellow.
SkColor DebugColors::TouchEventHandlerRectBorderColor() {
  return SkColorSetARGB(255, 239, 229, 60);
}
int DebugColors::TouchEventHandlerRectBorderWidth() { return 2; }
SkColor DebugColors::TouchEventHandlerRectFillColor() {
  return SkColorSetARGB(30, 239, 229, 60);
}

// Wheel-event-handler rects in green.
SkColor DebugColors::WheelEventHandlerRectBorderColor() {
  return SkColorSetARGB(255, 189, 209, 57);
}
int DebugColors::WheelEventHandlerRectBorderWidth() { return 2; }
SkColor DebugColors::WheelEventHandlerRectFillColor() {
  return SkColorSetARGB(30, 189, 209, 57);
}

// Scroll-event-handler rects in teal.
SkColor DebugColors::ScrollEventHandlerRectBorderColor() {
  return SkColorSetARGB(255, 24, 167, 181);
}
int DebugColors::ScrollEventHandlerRectBorderWidth() { return 2; }
SkColor DebugColors::ScrollEventHandlerRectFillColor() {
  return SkColorSetARGB(30, 24, 167, 181);
}

// Non-fast-scrollable rects in orange.
SkColor DebugColors::NonFastScrollableRectBorderColor() {
  return SkColorSetARGB(255, 238, 163, 59);
}
int DebugColors::NonFastScrollableRectBorderWidth() { return 2; }
SkColor DebugColors::NonFastScrollableRectFillColor() {
  return SkColorSetARGB(30, 238, 163, 59);
}

// Animation bounds are lime-green.
SkColor DebugColors::LayerAnimationBoundsBorderColor() {
  return SkColorSetARGB(255, 112, 229, 0);
}
int DebugColors::LayerAnimationBoundsBorderWidth() { return 2; }
SkColor DebugColors::LayerAnimationBoundsFillColor() {
  return SkColorSetARGB(30, 112, 229, 0);
}

// Non-Painted rects in cyan.
SkColor DebugColors::NonPaintedFillColor() { return SK_ColorCYAN; }

// Missing picture rects in magenta.
SkColor DebugColors::MissingPictureFillColor() { return SK_ColorMAGENTA; }

// Missing resize invalidations are in salmon pink.
SkColor DebugColors::MissingResizeInvalidations() {
  return SkColorSetARGB(255, 255, 155, 170);
}

// Picture borders in transparent blue.
SkColor DebugColors::PictureBorderColor() {
  return SkColorSetARGB(100, 0, 0, 200);
}

// ======= HUD widget colors =======

SkColor DebugColors::HUDBackgroundColor() {
  return SkColorSetARGB(215, 17, 17, 17);
}
SkColor DebugColors::HUDSeparatorLineColor() {
  return SkColorSetARGB(255, 130, 130, 130);
}
SkColor DebugColors::HUDIndicatorLineColor() {
  return SkColorSetARGB(255, 80, 80, 80);
}

SkColor DebugColors::PlatformLayerTreeTextColor() { return SK_ColorRED; }
SkColor DebugColors::FPSDisplayTextAndGraphColor() { return SK_ColorRED; }
SkColor DebugColors::MemoryDisplayTextColor() {
  return SkColorSetARGB(255, 220, 220, 220);
}

// Paint time display in green (similar to paint times in the WebInspector)
SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() {
  return SkColorSetRGB(75, 155, 55);
}

}  // namespace cc