Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / cc / debug / debug_colors.cc
blob38ecf54c8534e482ca50e475c37e71a698611d45
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 "base/macros.h"
7 #include "cc/debug/debug_colors.h"
9 #include "cc/trees/layer_tree_impl.h"
11 namespace cc {
13 static float Scale(float width, const LayerTreeImpl* tree_impl) {
14 return width * (tree_impl ? tree_impl->device_scale_factor() : 1);
17 // ======= Layer border colors =======
19 // Tiled content layers are orange.
20 SkColor DebugColors::TiledContentLayerBorderColor() {
21 return SkColorSetARGB(128, 255, 128, 0);
23 int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl* tree_impl) {
24 return Scale(2, tree_impl);
27 // Image layers are olive.
28 SkColor DebugColors::ImageLayerBorderColor() {
29 return SkColorSetARGB(128, 128, 128, 0);
31 int DebugColors::ImageLayerBorderWidth(const LayerTreeImpl* tree_impl) {
32 return Scale(2, tree_impl);
35 // Non-tiled content layers area green.
36 SkColor DebugColors::ContentLayerBorderColor() {
37 return SkColorSetARGB(128, 0, 128, 32);
39 int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl* tree_impl) {
40 return Scale(2, tree_impl);
43 // Masking layers are pale blue and wide.
44 SkColor DebugColors::MaskingLayerBorderColor() {
45 return SkColorSetARGB(48, 128, 255, 255);
47 int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl* tree_impl) {
48 return Scale(20, tree_impl);
51 // Other container layers are yellow.
52 SkColor DebugColors::ContainerLayerBorderColor() {
53 return SkColorSetARGB(192, 255, 255, 0);
55 int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl* tree_impl) {
56 return Scale(2, tree_impl);
59 // Surface layers are a blue-ish green.
60 SkColor DebugColors::SurfaceLayerBorderColor() {
61 return SkColorSetARGB(128, 0, 255, 136);
63 int DebugColors::SurfaceLayerBorderWidth(const LayerTreeImpl* tree_impl) {
64 return Scale(2, tree_impl);
67 // Render surfaces are blue.
68 SkColor DebugColors::SurfaceBorderColor() {
69 return SkColorSetARGB(100, 0, 0, 255);
71 int DebugColors::SurfaceBorderWidth(const LayerTreeImpl* tree_impl) {
72 return Scale(2, tree_impl);
75 // Replicas of render surfaces are purple.
76 SkColor DebugColors::SurfaceReplicaBorderColor() {
77 return SkColorSetARGB(100, 160, 0, 255);
79 int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl* tree_impl) {
80 return Scale(2, tree_impl);
83 // ======= Tile colors =======
85 // High-res tile borders are cyan.
86 SkColor DebugColors::HighResTileBorderColor() {
87 return SkColorSetARGB(100, 80, 200, 200);
89 int DebugColors::HighResTileBorderWidth(const LayerTreeImpl* tree_impl) {
90 return Scale(1, tree_impl);
93 // Low-res tile borders are purple.
94 SkColor DebugColors::LowResTileBorderColor() {
95 return SkColorSetARGB(100, 212, 83, 192);
97 int DebugColors::LowResTileBorderWidth(const LayerTreeImpl* tree_impl) {
98 return Scale(2, tree_impl);
101 // Other high-resolution tile borders are yellow.
102 SkColor DebugColors::ExtraHighResTileBorderColor() {
103 return SkColorSetARGB(100, 239, 231, 20);
105 int DebugColors::ExtraHighResTileBorderWidth(const LayerTreeImpl* tree_impl) {
106 return Scale(2, tree_impl);
109 // Other low-resolution tile borders are green.
110 SkColor DebugColors::ExtraLowResTileBorderColor() {
111 return SkColorSetARGB(100, 93, 186, 18);
113 int DebugColors::ExtraLowResTileBorderWidth(const LayerTreeImpl* tree_impl) {
114 return Scale(2, tree_impl);
117 // Missing tile borders are dark grey.
118 SkColor DebugColors::MissingTileBorderColor() {
119 return SkColorSetARGB(64, 64, 64, 0);
121 int DebugColors::MissingTileBorderWidth(const LayerTreeImpl* tree_impl) {
122 return Scale(1, tree_impl);
125 // Solid color tile borders are grey.
126 SkColor DebugColors::SolidColorTileBorderColor() {
127 return SkColorSetARGB(128, 128, 128, 128);
129 int DebugColors::SolidColorTileBorderWidth(const LayerTreeImpl* tree_impl) {
130 return Scale(1, tree_impl);
133 // OOM tile borders are red.
134 SkColor DebugColors::OOMTileBorderColor() {
135 return SkColorSetARGB(100, 255, 0, 0);
137 int DebugColors::OOMTileBorderWidth(const LayerTreeImpl* tree_impl) {
138 return Scale(1, tree_impl);
141 // Direct picture borders are chartreuse.
142 SkColor DebugColors::DirectPictureBorderColor() {
143 return SkColorSetARGB(255, 127, 255, 0);
145 int DebugColors::DirectPictureBorderWidth(const LayerTreeImpl* tree_impl) {
146 return Scale(1, tree_impl);
149 // ======= Checkerboard colors =======
151 // Non-debug checkerboards are grey.
152 SkColor DebugColors::DefaultCheckerboardColor() {
153 return SkColorSetRGB(241, 241, 241);
156 // Invalidated tiles get sky blue checkerboards.
157 SkColor DebugColors::InvalidatedTileCheckerboardColor() {
158 return SkColorSetRGB(128, 200, 245);
161 // Evicted tiles get pale red checkerboards.
162 SkColor DebugColors::EvictedTileCheckerboardColor() {
163 return SkColorSetRGB(255, 200, 200);
166 // ======= Debug rect colors =======
168 static SkColor FadedGreen(int initial_value, int step) {
169 DCHECK_GE(step, 0);
170 DCHECK_LE(step, DebugColors::kFadeSteps);
171 int value = step * initial_value / DebugColors::kFadeSteps;
172 return SkColorSetARGB(value, 0, 195, 0);
174 // Paint rects in green.
175 SkColor DebugColors::PaintRectBorderColor(int step) {
176 return FadedGreen(255, step);
178 int DebugColors::PaintRectBorderWidth() { return 2; }
179 SkColor DebugColors::PaintRectFillColor(int step) {
180 return FadedGreen(60, step);
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 // Touch-event-handler rects in yellow.
220 SkColor DebugColors::TouchEventHandlerRectBorderColor() {
221 return SkColorSetARGB(255, 239, 229, 60);
223 int DebugColors::TouchEventHandlerRectBorderWidth() { return 2; }
224 SkColor DebugColors::TouchEventHandlerRectFillColor() {
225 return SkColorSetARGB(30, 239, 229, 60);
228 // Wheel-event-handler rects in green.
229 SkColor DebugColors::WheelEventHandlerRectBorderColor() {
230 return SkColorSetARGB(255, 189, 209, 57);
232 int DebugColors::WheelEventHandlerRectBorderWidth() { return 2; }
233 SkColor DebugColors::WheelEventHandlerRectFillColor() {
234 return SkColorSetARGB(30, 189, 209, 57);
237 // Scroll-event-handler rects in teal.
238 SkColor DebugColors::ScrollEventHandlerRectBorderColor() {
239 return SkColorSetARGB(255, 24, 167, 181);
241 int DebugColors::ScrollEventHandlerRectBorderWidth() { return 2; }
242 SkColor DebugColors::ScrollEventHandlerRectFillColor() {
243 return SkColorSetARGB(30, 24, 167, 181);
246 // Non-fast-scrollable rects in orange.
247 SkColor DebugColors::NonFastScrollableRectBorderColor() {
248 return SkColorSetARGB(255, 238, 163, 59);
250 int DebugColors::NonFastScrollableRectBorderWidth() { return 2; }
251 SkColor DebugColors::NonFastScrollableRectFillColor() {
252 return SkColorSetARGB(30, 238, 163, 59);
255 // Animation bounds are lime-green.
256 SkColor DebugColors::LayerAnimationBoundsBorderColor() {
257 return SkColorSetARGB(255, 112, 229, 0);
259 int DebugColors::LayerAnimationBoundsBorderWidth() { return 2; }
260 SkColor DebugColors::LayerAnimationBoundsFillColor() {
261 return SkColorSetARGB(30, 112, 229, 0);
264 // Non-Painted rects in cyan.
265 SkColor DebugColors::NonPaintedFillColor() { return SK_ColorCYAN; }
267 // Missing picture rects in magenta.
268 SkColor DebugColors::MissingPictureFillColor() { return SK_ColorMAGENTA; }
270 // Missing resize invalidations are in salmon pink.
271 SkColor DebugColors::MissingResizeInvalidations() {
272 return SkColorSetARGB(255, 255, 155, 170);
275 // Picture borders in transparent blue.
276 SkColor DebugColors::PictureBorderColor() {
277 return SkColorSetARGB(100, 0, 0, 200);
280 // ======= HUD widget colors =======
282 SkColor DebugColors::HUDBackgroundColor() {
283 return SkColorSetARGB(215, 17, 17, 17);
285 SkColor DebugColors::HUDSeparatorLineColor() {
286 return SkColorSetARGB(255, 130, 130, 130);
288 SkColor DebugColors::HUDIndicatorLineColor() {
289 return SkColorSetARGB(255, 80, 80, 80);
292 SkColor DebugColors::PlatformLayerTreeTextColor() { return SK_ColorRED; }
293 SkColor DebugColors::FPSDisplayTextAndGraphColor() { return SK_ColorRED; }
294 SkColor DebugColors::MemoryDisplayTextColor() {
295 return SkColorSetARGB(255, 220, 220, 220);
298 // Paint time display in green (similar to paint times in the WebInspector)
299 SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() {
300 return SkColorSetRGB(75, 155, 55);
303 } // namespace cc